mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
c46143f0ac
* chore: update copyright year * fix --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
21 lines
584 B
TypeScript
21 lines
584 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { assert } from "../assert/assert.ts";
|
|
import { assertEquals } from "../assert/assert_equals.ts";
|
|
import { toBlob } from "./to_blob.ts";
|
|
|
|
Deno.test("[streams] toBlob", async () => {
|
|
const stream = ReadableStream.from([
|
|
new Uint8Array([1, 2, 3, 4, 5]),
|
|
new Uint8Array([6, 7]),
|
|
new Uint8Array([8, 9]),
|
|
]);
|
|
|
|
const blob = await toBlob(stream);
|
|
assert(blob instanceof Blob);
|
|
assertEquals(
|
|
await blob.arrayBuffer(),
|
|
new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]).buffer,
|
|
);
|
|
});
|