Skip to content

Commit 289f6d1

Browse files
committed
test: Add test for encoding Sets as lists
1 parent d982ff9 commit 289f6d1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

test/encode.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ test('bencode#encode()', function (t) {
120120
t.equal(bencode.encode([32, 12]).toString(), 'li32ei12ee')
121121
t.equal(bencode.encode([':asdf:']).toString(), 'l6::asdf:e')
122122
})
123+
t.test('should be able to encode a Set as a list', function (t) {
124+
t.plan(2)
125+
t.equal(bencode.encode(new Set([32, 12])).toString(), 'li32ei12ee')
126+
t.equal(bencode.encode(new Set([':asdf:'])).toString(), 'l6::asdf:e')
127+
})
123128
t.test('should be able to encode an object', function (t) {
124129
t.plan(3)
125130
t.equal(bencode.encode({ 'a': 'bc' }).toString(), 'd1:a2:bce')

0 commit comments

Comments
 (0)