From 78850df0f48a71934a50087fed794eae26488418 Mon Sep 17 00:00:00 2001 From: dimaslz Date: Sun, 28 Jan 2024 08:32:36 +0100 Subject: [PATCH] test(cli): update tests --- packages/cli/global-setup.ts | 1 + packages/cli/src/utils/hosts.test.ts | 4 ---- packages/cli/src/utils/list-configs.test.ts | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/cli/global-setup.ts b/packages/cli/global-setup.ts index 2913a81..adfdf1f 100644 --- a/packages/cli/global-setup.ts +++ b/packages/cli/global-setup.ts @@ -40,6 +40,7 @@ beforeEach(() => { throw new Error(); }); + vi.spyOn(fs, "writeFileSync").mockImplementation(vi.fn()); vi.spyOn(fs, "readdirSync").mockReturnValue([ "some-domain.com-cert.pem", "some-domain.com-key.pem", diff --git a/packages/cli/src/utils/hosts.test.ts b/packages/cli/src/utils/hosts.test.ts index 02fe18d..030b5eb 100644 --- a/packages/cli/src/utils/hosts.test.ts +++ b/packages/cli/src/utils/hosts.test.ts @@ -57,8 +57,6 @@ ${HOSTS_END} 127.0.0.1 other-domain.com `); - vi.spyOn(fs, "writeFileSync").mockImplementation(vi.fn()); - await setContentToHosts( ` 127.0.0.1 local.domain.io @@ -151,8 +149,6 @@ ${HOSTS_START} ${HOSTS_END} `); - vi.spyOn(fs, "writeFile").mockImplementation(vi.fn()); - await updateHosts("other-domain.com"); // read files diff --git a/packages/cli/src/utils/list-configs.test.ts b/packages/cli/src/utils/list-configs.test.ts index f78f1c9..6fe5ce7 100644 --- a/packages/cli/src/utils/list-configs.test.ts +++ b/packages/cli/src/utils/list-configs.test.ts @@ -30,6 +30,6 @@ describe("Utils - listConfigs", () => { listConfigs(configs); - expect(shell.echo).matchSnapshot(); + expect(shell.echo).toMatchSnapshot(); }); });