2022-10-12 09:47:13 +00:00
|
|
|
import { assertEquals } from "../../test_deps.ts";
|
2022-10-19 07:52:29 +00:00
|
|
|
import {
|
|
|
|
base64Decode,
|
|
|
|
base64DecodeDataUrl,
|
|
|
|
base64EncodedDataUrl,
|
|
|
|
} from "./base64.ts";
|
2022-10-10 12:50:21 +00:00
|
|
|
import { base64Encode } from "./base64.ts";
|
|
|
|
|
|
|
|
Deno.test("Base 64 encoding", () => {
|
|
|
|
const buf = new Uint8Array(3);
|
|
|
|
buf[0] = 1;
|
|
|
|
buf[1] = 2;
|
|
|
|
buf[2] = 3;
|
|
|
|
|
|
|
|
assertEquals(buf, base64Decode(base64Encode(buf)));
|
2022-10-19 07:52:29 +00:00
|
|
|
|
|
|
|
assertEquals(
|
|
|
|
buf,
|
|
|
|
base64DecodeDataUrl(base64EncodedDataUrl("application/octet-stream", buf)),
|
|
|
|
);
|
2022-10-10 12:50:21 +00:00
|
|
|
});
|