Skip to content

Commit

Permalink
test(cli): update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaslz committed Jan 28, 2024
1 parent 39e69e3 commit 8764b04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/cli/src/on-reset-hosts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ ${HOSTS_END}

// write files
expect(fs.writeFileSync).toBeCalledWith(
expect.stringMatching(/\/.tmp-hosts/i),
"/root/path/.tmp-hosts",
`
127.0.0.1 other-domain.com
`,
);

expect(updateSystemHosts).toBeCalledWith(
expect.stringMatching(/\/.tmp-hosts/i),
);
expect(updateSystemHosts).toBeCalledWith("/root/path/.tmp-hosts");
});
});
});
1 change: 1 addition & 0 deletions packages/cli/src/utils/hosts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ ${HOSTS_END}

test("set hosts content without Local SSL config slot", async () => {
vi.spyOn(consola, "prompt").mockReturnValue(Promise.resolve(true));
vi.spyOn(fs, "writeFileSync").mockImplementation(vi.fn());
vi.spyOn(fs, "readFileSync").mockReturnValue(`
127.0.0.1 localhost
127.0.0.1 other-domain.com
Expand Down

0 comments on commit 8764b04

Please sign in to comment.