Skip to content

Commit

Permalink
chore: add test for #208
Browse files Browse the repository at this point in the history
  • Loading branch information
Gozala committed Oct 17, 2022
1 parent 0ec751a commit c9e970f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/test-link.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,17 @@ describe('decode', () => {
assert.deepStrictEqual(multihash, hash)
})
})

describe('equality', () => {
it('passes equality check despite diff offsets', () => {
const expect = Link.parse('QmRnTwp7crEvYEdyWhW7FGQ3thWMvgTATcbUs1uyHVuSNq')
const buffer = new ArrayBuffer(256)
const bytes = new Uint8Array(buffer, 12, expect.bytes.byteLength)
bytes.set(expect.bytes)

const actual = Link.decode(bytes)
assert.equal(expect.toString(), actual.toString())

assert.deepEqual(expect, actual)
})
})

0 comments on commit c9e970f

Please sign in to comment.