A [Chai](https://chaijs.com) plugin providing `equalBytes` assertions for comparing byte arrays (such as `Uint8Array`).
npm install @nice-labs/chai-bytesA Chai plugin providing equalBytes assertions for comparing byte arrays (such as Uint8Array).
Forked from
``typescript
import { expect, assert, use } from 'chai'
import { chaiBytes } from 'chai-bytes'
use(chaiBytes)
const bytes = Uint8Array.of(0x01, 0x02, 0x03, 0x04, 0x05)
// BDD style
expect(bytes).to.equalBytes('0102030405')
// Assert style
assert.equalBytes(bytes, [0x01, 0x02, 0x03, 0x04, 0x05], 'should match bytes')
`
The equalBytes assertion accepts:
- Hex strings: e.g., 'C0FFEE'[1, 2, 3]
- Arrays: e.g., length
- Array-like objects: Any object with a property and numeric indices (including Uint8Array)
If the expected value is not one of these, a TypeError` is thrown.
MIT LICENSE