We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97df33b commit 67c9daeCopy full SHA for 67c9dae
1 file changed
test/encode.test.js
@@ -31,6 +31,16 @@ test('bencode#encode()', function (t) {
31
t.equal(bencode.encode(data).toString(), 'd2:1211:Hello World2:34i12345ee')
32
})
33
34
+ t.test('should encode a Map as dictionary', function (t) {
35
+ t.plan(1)
36
+ var data = new Map([
37
+ [ 12, 'Hello World' ],
38
+ [ '34', 12345 ],
39
+ [ Buffer.from('buffer key'), Buffer.from('buffer value') ]
40
+ ])
41
+ t.equal(bencode.encode(data).toString(), 'd2:1211:Hello World2:34i12345e10:buffer key12:buffer valuee')
42
+ })
43
+
44
t.test('should be able to encode a positive integer', function (t) {
45
t.plan(1)
46
t.equal(bencode.encode(123).toString(), 'i123e')
0 commit comments