test.govlab/patterns/core/loaders/representation.loader.test.ts

test.govlab/patterns/core/loaders/representation.loader.test.ts is a file in Codebase Testing. 21 lines of code and 0 definitions.

import { BUILTIN_REPRESENTATIONS, loadPlugins } from "@govlab/patterns/core/loaders/representation.loader.ts";
import { describe, expect, it } from "vitest";
import { join } from "node:path";
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";

describe("the representation loader", () => {
    it("loads every built-in representation plugin", () => {
        expect([...BUILTIN_REPRESENTATIONS].sort((a, b) => a.localeCompare(b))).toStrictEqual([
            "distribution",
            "graph",
            "grid",
            "sequence",
            "tree",
            "vector",
        ]);
    });

    it("loads nothing new from a folder without plugins", async () => {
        const empty = mkdtempSync(join(tmpdir(), "pl-plugins-"));
        await expect(loadPlugins(empty)).resolves.toStrictEqual([]);
    });
});