-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(util): tune command assertions in npm
- Loading branch information
1 parent
a609666
commit 5ff51af
Showing
1 changed file
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,26 +11,26 @@ jest.mock('../../../common/util/logger', () => ({ | |
}, | ||
})); | ||
|
||
jest.mock('../../../common/util/helpers', () => { | ||
const originalModule = jest.requireActual('../../../common/util/helpers'); | ||
jest.mock('child_process', () => { | ||
const originalModule = jest.requireActual('child_process'); | ||
return { | ||
...originalModule, | ||
execPromise: async (param: any) => { | ||
execFileSync: (file: any, args: any) => { | ||
switch (process.env.NPM_INSTALL) { | ||
case 'true': | ||
expect(param).toEqual('npm install @grnsft/[email protected]'); | ||
expect(file).toEqual('npm install @grnsft/[email protected]'); | ||
break; | ||
case 'npm init -y': | ||
expect(param).toEqual('npm init -y'); | ||
expect(file).toEqual('npm init -y'); | ||
break; | ||
case 'if-check': | ||
expect( | ||
[ | ||
'npm run if-env -- -m ./src/__mocks__/mock-manifest.yaml', | ||
'npm run if-run -- -m ./src/__mocks__/mock-manifest.yaml -o src/__mocks__/re-mock-manifest', | ||
"node -p 'Boolean(process.stdout.isTTY)'", | ||
'node -p Boolean(process.stdout.isTTY)', | ||
'npm run if-diff -- -s src/__mocks__/re-mock-manifest.yaml -t ./src/__mocks__/mock-manifest.yaml', | ||
].includes(param) | ||
].includes(`${file} ${args.join(' ')}`) | ||
).toBeTruthy(); | ||
break; | ||
} | ||
|
@@ -50,7 +50,7 @@ describe('if-check/util/npm: ', () => { | |
|
||
await executeCommands(manifest, false); | ||
|
||
expect.assertions(5); | ||
expect.assertions(6); | ||
expect(logSpy).toHaveBeenCalledWith( | ||
'✔ if-check successfully verified mock-manifest.yaml\n' | ||
); | ||
|