Skip to content

Commit 82f855f

Browse files
committed
test: dataviews
1 parent ddc97cf commit 82f855f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

__test__/objects.spec.ts

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ describe("Binarypack", () => {
3737
expect(await packAndUnpack(undefined)).toEqual(undefined);
3838
});
3939

40+
it("should transfer Uint8Array views correctly", async () => {
41+
const arr = new Uint8Array(8);
42+
for (let i = 0; i < 8; i++) arr[i] = i;
43+
const v = new Uint8Array(arr.buffer, 4); // Half the array
44+
45+
expect(new Uint8Array(await packAndUnpack<ArrayBuffer>(v))).toEqual(v);
46+
});
47+
4048
it("should transfer Uint8Array as ArrayBuffer", async () => {
4149
const values = [
4250
new Uint8Array(),

0 commit comments

Comments
 (0)