Skip to content

Commit

Permalink
chore: add test for structural copying (#206)
Browse files Browse the repository at this point in the history
* chore: add test for structural copying

* fix: remove generated import

* fix: lint errors

* fix: another attempt to make eslint happy

* chore: and another attemp to make eslint happy
  • Loading branch information
Gozala authored and rvagg committed Oct 8, 2022
1 parent 146c514 commit d6f56c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/test-cid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,4 +704,14 @@ describe('CID', () => {
assert.isFalse(Object.keys(cid).includes('asCID'))
assert.equal(cid.asCID, cid)
})

it('CID can be moved across JS realms', async () => {
const cid = CID.parse('bafybeif2pall7dybz7vecqka3zo24irdwabwdi4wc55jznaq75q7eaavvu')
const { port1: sender, port2: receiver } = new MessageChannel()
sender.postMessage(cid)
const cid2 = await new Promise((resolve) => {
receiver.onmessage = (event) => { resolve(event.data) }
})
assert.equal(cid2.asCID, cid2)
})
})

0 comments on commit d6f56c6

Please sign in to comment.