Skip to content

Commit

Permalink
chore: test case for prompt-installation
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Mar 6, 2020
1 parent a164a67 commit 37f7873
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/package-utils/__tests__/index.test.ts
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();
});
});

0 comments on commit 37f7873

Please sign in to comment.