cli.test.ts 495 B

123456789101112131415
  1. import {
  2. expect,
  3. it,
  4. patch,
  5. } from "https://code.thunderk.net/typescript/devtools/raw/1.2.2/testing.ts";
  6. import { makeAbsolute, System } from "./cli.ts";
  7. it("makes paths absolute", () => {
  8. expect(makeAbsolute("test", "/home/user")).toEqual("/home/user/test");
  9. expect(makeAbsolute("/srv/test", "/home/user")).toEqual("/srv/test");
  10. patch(System, "getenv", (mock) => {
  11. mock.stub(() => "/home/user");
  12. expect(makeAbsolute("~/test", "/tmp")).toEqual("/home/user/test");
  13. });
  14. });