2022-10-12 09:47:13 +00:00
|
|
|
import { AssetBundle } from "./bundle.ts";
|
|
|
|
import { assertEquals } from "../../test_deps.ts";
|
|
|
|
|
|
|
|
Deno.test("Asset bundle", () => {
|
|
|
|
const assetBundle = new AssetBundle();
|
2023-05-23 18:53:53 +00:00
|
|
|
assetBundle.writeTextFileSync("test.txt", "text/plain", "Sup yo");
|
2022-10-12 09:47:13 +00:00
|
|
|
assertEquals("text/plain", assetBundle.getMimeType("test.txt"));
|
|
|
|
assertEquals("Sup yo", assetBundle.readTextFileSync("test.txt"));
|
|
|
|
const buf = new Uint8Array(3);
|
|
|
|
buf[0] = 1;
|
|
|
|
buf[1] = 2;
|
|
|
|
buf[2] = 3;
|
2023-05-23 18:53:53 +00:00
|
|
|
assetBundle.writeFileSync("test.bin", "application/octet-stream", buf);
|
2022-10-12 09:47:13 +00:00
|
|
|
assertEquals("application/octet-stream", assetBundle.getMimeType("test.bin"));
|
|
|
|
assertEquals(buf, assetBundle.readFileSync("test.bin"));
|
|
|
|
});
|