import { ProjectNormalizer } from "./normalize.ts"; import { describe, expect, it, mockfn } from "../deps.testing.ts"; describe(ProjectNormalizer, () => { it("uses 'deno fmt' to format path", async () => { const sys = { run: mockfn(() => ({ async status() { return { success: true }; }, async output() { return new TextEncoder().encode(""); }, async stderrOutput() { return new TextEncoder().encode(""); }, })), } as typeof Deno; const normalizer = new ProjectNormalizer(sys); await normalizer.formatPath("dist/test.js"); expect(sys.run).toHaveBeenCalledTimes(1); expect(sys.run).toHaveBeenCalledWith({ cmd: ["./run", "fmt", "-q", "dist/test.js"], stdout: "piped", stderr: "piped", }); }); });