diff --git a/src/__tests__/if-check/util/npm.test.ts b/src/__tests__/if-check/util/npm.test.ts index 966717c7..d7b4d798 100644 --- a/src/__tests__/if-check/util/npm.test.ts +++ b/src/__tests__/if-check/util/npm.test.ts @@ -35,21 +35,6 @@ jest.mock('child_process', () => { ) ).toBeTruthy(); break; - case 'if-check-cwd': - expect(param).toEqual( - "npm run if-env -- -m ./src/__mocks__/mock-manifest.yaml -c && npm run if-run -- -m ./src/__mocks__/mock-manifest.yaml -o src/__mocks__/re-mock-manifest && node -p 'Boolean(process.stdout.isTTY)' | npm run if-diff -- -s src/__mocks__/re-mock-manifest.yaml -t ./src/__mocks__/mock-manifest.yaml" - ); - break; - case 'if-check-global': - expect(param).toEqual( - "if-env -m ./src/__mocks__/mock-manifest.yaml && if-run -m ./src/__mocks__/mock-manifest.yaml -o src/__mocks__/re-mock-manifest && node -p 'Boolean(process.stdout.isTTY)' | if-diff -s src/__mocks__/re-mock-manifest.yaml -t ./src/__mocks__/mock-manifest.yaml" - ); - break; - case 'if-check-prefix': - expect(param).toEqual( - "if-env --prefix=.. -m ./src/__mocks__/mock-manifest.yaml && if-run --prefix=.. -m ./src/__mocks__/mock-manifest.yaml -o src/__mocks__/re-mock-manifest && node -p 'Boolean(process.stdout.isTTY)' | if-diff --prefix=.. -s src/__mocks__/re-mock-manifest.yaml -t ./src/__mocks__/mock-manifest.yaml" - ); - break; } return; }, @@ -72,47 +57,5 @@ describe('if-check/util/npm: ', () => { '✔ if-check successfully verified mock-manifest.yaml\n' ); }); - - it('successfully executes with cwd command.', async () => { - process.env.NPM_INSTALL = 'if-check-cwd'; - const manifest = './src/__mocks__/mock-manifest.yaml'; - const logSpy = jest.spyOn(global.console, 'log'); - - await executeCommands(manifest, true); - - expect.assertions(2); - expect(logSpy).toHaveBeenCalledWith( - '✔ if-check successfully verified mock-manifest.yaml\n' - ); - }); - - it('successfully executes with correct commands when is running from global.', async () => { - process.env.npm_config_global = 'true'; - process.env.NPM_INSTALL = 'if-check-global'; - const manifest = './src/__mocks__/mock-manifest.yaml'; - const logSpy = jest.spyOn(global.console, 'log'); - - await executeCommands(manifest, false); - - expect.assertions(2); - expect(logSpy).toHaveBeenCalledWith( - '✔ if-check successfully verified mock-manifest.yaml\n' - ); - }); - - it('successfully executes with correct commands when CURRENT_DIR is provided.', async () => { - process.env.CURRENT_DIR = './mock-path'; - process.env.npm_config_global = 'true'; - process.env.NPM_INSTALL = 'if-check-prefix'; - const manifest = './src/__mocks__/mock-manifest.yaml'; - const logSpy = jest.spyOn(global.console, 'log'); - - await executeCommands(manifest, false); - - expect.assertions(2); - expect(logSpy).toHaveBeenCalledWith( - '✔ if-check successfully verified mock-manifest.yaml\n' - ); - }); }); });