Skip to content

Commit 1c242cc

Browse files
achingbrainrvagg
authored andcommitted
test: check for non-enumerability of asCID property
1 parent 384e74c commit 1c242cc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/test-cid.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,4 +696,12 @@ describe('CID', () => {
696696
const encoded = varint.encodeTo(2, new Uint8Array(32))
697697
assert.throws(() => CID.decode(encoded), 'Invalid CID version 2')
698698
})
699+
700+
it('asCID is non-enumerable', () => {
701+
const cid = CID.parse('bafybeif2pall7dybz7vecqka3zo24irdwabwdi4wc55jznaq75q7eaavvu')
702+
703+
assert.isFalse(Object.prototype.propertyIsEnumerable.call(cid, 'asCID'))
704+
assert.isFalse(Object.keys(cid).includes('asCID'))
705+
assert.equal(cid.asCID, cid)
706+
})
699707
})

0 commit comments

Comments
 (0)