Skip to content

Commit

Permalink
test: check for non-enumerability of asCID property
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored and rvagg committed Oct 12, 2022
1 parent 6149fae commit b4ba07d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/test-cid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,4 +696,12 @@ describe('CID', () => {
const encoded = varint.encodeTo(2, new Uint8Array(32))
assert.throws(() => CID.decode(encoded), 'Invalid CID version 2')
})

it('asCID is non-enumerable', () => {
const cid = CID.parse('bafybeif2pall7dybz7vecqka3zo24irdwabwdi4wc55jznaq75q7eaavvu')

assert.isFalse(Object.prototype.propertyIsEnumerable.call(cid, 'asCID'))
assert.isFalse(Object.keys(cid).includes('asCID'))
assert.equal(cid.asCID, cid)
})
})

0 comments on commit b4ba07d

Please sign in to comment.