You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
846 B
TypeScript
26 lines
846 B
TypeScript
import { makeStaticByteArray } from "../utils";
|
|
|
|
describe("toEqualBuffer custom matcher", () => {
|
|
it("matches identical ArrayBuffers", () => {
|
|
const array = makeStaticByteArray(10);
|
|
expect(array.buffer).toEqualBuffer(array.buffer);
|
|
});
|
|
|
|
it("matches an identical ArrayBuffer and Uint8Array", () => {
|
|
const array = makeStaticByteArray(10);
|
|
expect(array.buffer).toEqualBuffer(array);
|
|
});
|
|
|
|
it("doesn't match different ArrayBuffers", () => {
|
|
const array1 = makeStaticByteArray(10);
|
|
const array2 = makeStaticByteArray(10, 11);
|
|
expect(array1.buffer).not.toEqualBuffer(array2.buffer);
|
|
});
|
|
|
|
it("doesn't match a different ArrayBuffer and Uint8Array", () => {
|
|
const array1 = makeStaticByteArray(10);
|
|
const array2 = makeStaticByteArray(10, 11);
|
|
expect(array1.buffer).not.toEqualBuffer(array2);
|
|
});
|
|
});
|