-
-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: test case for prompt-installation
- Loading branch information
1 parent
a164a67
commit 37f7873
Showing
1 changed file
with
10 additions
and
2 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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
'use strict'; | ||
|
||
import { packageExists } from '../src'; | ||
import * as packageUtils from '../src'; | ||
import ExternalCommand from '../../webpack-cli/lib/commands/ExternalCommand'; | ||
|
||
const mock = jest.spyOn(packageUtils, 'promptInstallation') | ||
mock.mockImplementation(() => { throw new Error() }) | ||
|
||
describe('@webpack-cli/package-utils', () => { | ||
it('should check existence of package', () => { | ||
const exists = packageExists('@webpack-cli/info'); | ||
const exists = packageUtils.packageExists('@webpack-cli/info'); | ||
|
||
expect(exists).toBeTruthy(); | ||
}); | ||
|
||
it('should not throw if the user interrupts', async () => { | ||
await expect(ExternalCommand.run('@webpack-cli/info')).resolves.not.toThrow(); | ||
}); | ||
}); |