Files
plainleaf/cmd/test/plug_run.test.ts
T
MaksandGitHub 8a3782e946 improve dependency management (#770)
* use import_map.json instead of per-file import

* remove test_deps.ts in favor of import_map

* remove common/deps.ts in favor of import_map

* use import_map instead of server/deps.ts

* make all plug-api files usable without an import_map

* make all lib files usable without an import_map

* remove web/deps.ts in favor of import_map

* fix plug build

* remove plug-api/deps.ts in favor of lib/deps.ts

* fix server deps bundled in client deps
2024-03-16 15:29:24 +01:00

40 lines
1.1 KiB
TypeScript

import { AssetBundle } from "$lib/asset_bundle/bundle.ts";
import { compileManifest } from "../compile.ts";
import * as esbuild from "esbuild";
import assets from "../../dist/plug_asset_bundle.json" assert { type: "json" };
import { assertEquals } from "$std/testing/asserts.ts";
import { dirname, join } from "$std/path/mod.ts";
import { MemoryKvPrimitives } from "$lib/data/memory_kv_primitives.ts";
import { runPlug } from "../plug_run.ts";
Deno.test("Test plug run", {
sanitizeResources: false,
sanitizeOps: false,
}, async () => {
const assetBundle = new AssetBundle(assets);
const testFolder = dirname(new URL(import.meta.url).pathname);
const testSpaceFolder = join(testFolder, "test_space");
const plugFolder = join(testSpaceFolder, "_plug");
await Deno.mkdir(plugFolder, { recursive: true });
await compileManifest(
join(testFolder, "test_plug_run.plug.yaml"),
plugFolder,
);
assertEquals(
await runPlug(
testSpaceFolder,
"test.run",
[],
assetBundle,
new MemoryKvPrimitives(),
),
"Hello",
);
// await Deno.remove(tempDir, { recursive: true });
esbuild.stop();
});