+ ].forEach((value) =>
+ assertStrictEquals(isWRMGBase32(value), false)
+ );
+ });
+});
+
+describe("toArrayBuffer", () => {
+ it("[[Call]] returns the argument for array buffers", () => {
+ const buffer = new ArrayBuffer();
+ assertStrictEquals(toArrayBuffer(buffer), buffer);
+ });
+
+ it("[[Call]] returns the buffer for data views", () => {
+ const src = Uint8Array.from([2, 3, 1]);
+ const buffer = toArrayBuffer(new DataView(src.buffer));
+ assert(buffer instanceof ArrayBuffer);
+ assertEquals(new Uint8Array(buffer), src);
+ });
+
+ it("[[Call]] returns the buffer for typed arrays", () => {
+ const src = Uint8Array.from([2, 3, 1]);
+ const buffer = toArrayBuffer(src);
+ assert(buffer instanceof ArrayBuffer);
+ assertEquals(new Uint8Array(buffer), src);
+ });
+
+ it("[[Call]] throws for others", () => {
+ [
+ undefined,
+ null,
+ true,
+ Symbol(),
+ 27,
+ 98n,
+ {},
+ [],
+ () => {},
+ new Proxy({}, {}),
+ "string",
+ ].forEach((value) =>
+ assertThrows(() => {
+ toArrayBuffer(value);
+ })
+ );