2020-04-26 18:22:09 +00:00
|
|
|
import { mockDetermineVersion } from './__mocks__/versioning';
|
2019-12-22 17:07:55 +00:00
|
|
|
import Input from './input';
|
|
|
|
|
2020-04-26 18:22:09 +00:00
|
|
|
jest.restoreAllMocks();
|
|
|
|
jest.mock('./versioning');
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
mockDetermineVersion.mockClear();
|
|
|
|
});
|
|
|
|
|
2019-12-22 17:07:55 +00:00
|
|
|
describe('Input', () => {
|
|
|
|
describe('getFromUser', () => {
|
2020-04-26 18:22:09 +00:00
|
|
|
it('does not throw', async () => {
|
|
|
|
await expect(Input.getFromUser()).resolves.not.toBeNull();
|
2019-12-22 17:07:55 +00:00
|
|
|
});
|
2020-01-27 22:03:29 +00:00
|
|
|
|
2020-04-26 18:22:09 +00:00
|
|
|
it('returns an object', async () => {
|
|
|
|
await expect(typeof (await Input.getFromUser())).toStrictEqual('object');
|
|
|
|
});
|
|
|
|
|
|
|
|
it.skip('calls version generator once', async () => {
|
|
|
|
await Input.getFromUser();
|
|
|
|
|
|
|
|
// Todo - make sure the versioning mock is actually hit after restoreAllMocks is used.
|
|
|
|
expect(mockDetermineVersion).toHaveBeenCalledTimes(1);
|
2020-01-27 22:03:29 +00:00
|
|
|
});
|
2019-12-22 17:07:55 +00:00
|
|
|
});
|
|
|
|
});
|