[DEPRECATED] Common base for my other typescript projects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

20 lines
538 B

import { Sys } from "./system.ts";
import { describe, expect, it, mock } from "./testing.ts";
describe("Sys", () => {
it("is mockable", () => {
function runSomething() {
Sys.run({ cmd: ["echo", "test"] });
}
expect(runSomething).toThrow(
'Requires run access to "echo", run again with the --allow-run flag',
);
mock(Sys, "run", undefined, (run) => {
runSomething();
expect(run).toHaveBeenCalledTimes(1);
expect(run).toHaveBeenCalledWith({ cmd: ["echo", "test"] });
});
});
});