Chai Assertions for Byte Arrays Equality
chai-bytes extends Chai with a
which can be used to test equality of byte arrays (i.e.,
const expect assert =;const buffer = 1 2 3 4 5 ;to;// `assert` style works, tooassert;
An expected value passed to
equalBytes can be:
- Hexadecimal string, e.g.,
- Array, e.g.,
[1, 2, 3]
- Array-like object (i.e., an object having the
lengthproperty and items accessible by integer properties). This includes
Uint8Arrayinstances, among other things
If the passed value does not fall into any of these categories,
TypeError is thrown.
chai-bytes uses combined code coverage from the tested browser environments
(Firefox and PhantomJS). This is because PhantomJS is a typical old environment
that may have problems with
Uint8Arrays (e.g., it misses a substantial parts
of their methods).
(c) 2018 Alex Ostrovski
chai-bytes is available under Apache-2.0 license.