deno.land / x / msgpack_javascript@v3.0.0-beta2 / test / decode-blob.test.ts

decode-blob.test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import assert from "assert";import { encode, decode, decodeAsync } from "@msgpack/msgpack";
(typeof Blob !== "undefined" ? describe : describe.skip)("Blob", () => { it("decodes it with `decode()`", async function () { const blob = new Blob([encode("Hello!")]); // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (!blob.arrayBuffer) { this.skip(); } assert.deepStrictEqual(decode(await blob.arrayBuffer()), "Hello!"); });
it("decodes it with `decodeAsync()`", async function () { const blob = new Blob([encode("Hello!")]); // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (!blob.stream) { this.skip(); }
// use any because the type of Blob#stream() in @types/node does not make sense here. // eslint-disable-next-line @typescript-eslint/no-unsafe-argument assert.deepStrictEqual(await decodeAsync(blob.stream() as any), "Hello!"); });});
msgpack_javascript

Version Info

Tagged at
a year ago