2019-12-22 17:07:55 +00:00
|
|
|
import Input from './input';
|
2020-04-27 23:43:15 +00:00
|
|
|
import Versioning from './versioning';
|
2019-12-22 17:07:55 +00:00
|
|
|
|
2020-04-27 23:43:15 +00:00
|
|
|
const determineVersion = jest
|
|
|
|
.spyOn(Versioning, 'determineVersion')
|
|
|
|
.mockImplementation(() => '1.3.37');
|
2020-04-26 18:22:09 +00:00
|
|
|
|
2020-04-27 23:43:15 +00:00
|
|
|
afterEach(() => {
|
|
|
|
jest.clearAllMocks();
|
2020-04-26 18:22:09 +00:00
|
|
|
});
|
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
|
2020-04-27 23:43:15 +00:00
|
|
|
it('calls version generator once', async () => {
|
2020-04-26 18:22:09 +00:00
|
|
|
await Input.getFromUser();
|
2020-04-27 23:43:15 +00:00
|
|
|
expect(determineVersion).toHaveBeenCalledTimes(1);
|
2020-01-27 22:03:29 +00:00
|
|
|
});
|
2019-12-22 17:07:55 +00:00
|
|
|
});
|
|
|
|
});
|