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 2b1cb08 commit d771dc5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"build-run": "ncc build -m src/run.ts -o dist/run",
"build": "ncc build -m src/index.ts -o dist && npm run build-run",
"to-publish": "npx vite-node publish.js",
"test": "vitest --reporter=verbose",
"test": "vitest --reporter=verbose --pool=forks",
"lint": "eslint ./src"
},
"dependencies": {
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/src/utils/generate-proxy-image.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe("Utils - generateProxyImage", () => {
]);

expect(fs.existsSync).toBeCalledTimes(4);

expect(mkcert).toBeCalledTimes(2);
expect(mkcert).nthCalledWith(
1,
Expand All @@ -67,6 +68,10 @@ describe("Utils - generateProxyImage", () => {
"/root/path/.local-ssl-management/ssl",
);

// read files
expect(fs.readFileSync).not.toBeCalled();

// write files
expect(fs.writeFileSync).toBeCalledTimes(2);
expect(fs.writeFileSync).toMatchSnapshot();

Expand Down
4 changes: 4 additions & 0 deletions packages/cli/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export default mergeConfig(
globals: true,
environment: "node",
setupFiles: "./global-setup.ts",
clearMocks: true,
snapshotFormat: {
printBasicPrototype: false,
},
},
resolve: {
alias: {
Expand Down

0 comments on commit d771dc5

Please sign in to comment.