diff --git a/test/version.test.ts b/test/version.test.ts new file mode 100644 index 00000000..6f788773 --- /dev/null +++ b/test/version.test.ts @@ -0,0 +1,17 @@ +import { cli } from '../src'; +import * as utils from '../src/utils/configUtils'; + +describe('version', () => { + it('should print version', async () => { + jest.spyOn(utils, 'parseJson').mockResolvedValue({ version: '1.2.3' }); + const spy = jest.spyOn(console, 'info'); + + await cli.execute([ + '', + '', + '--version' + ]); + + expect(spy).toHaveBeenCalledWith('httpyac v1.2.3'); + }); +});