From c90a575c249a975cb269f41b24d35085c76b18ed Mon Sep 17 00:00:00 2001 From: Stafford Williams Date: Thu, 18 Nov 2021 23:38:20 +1100 Subject: [PATCH] add version test --- test/version.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/version.test.ts 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'); + }); +});