From 7dc20360957ca8ad809509490e702bdde52b1dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Fernandes=20Gon=C3=A7alves=20Nogueira?= Date: Tue, 24 Dec 2019 09:54:04 -0300 Subject: [PATCH] test(tauri.js) add tests for --version option --- .../test/jest/__tests__/tauri.spec.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/cli/tauri.js/test/jest/__tests__/tauri.spec.js b/cli/tauri.js/test/jest/__tests__/tauri.spec.js index 6d7b3107c..7bb84868b 100644 --- a/cli/tauri.js/test/jest/__tests__/tauri.spec.js +++ b/cli/tauri.js/test/jest/__tests__/tauri.spec.js @@ -33,8 +33,21 @@ describe('[CLI] tauri.js', () => { }) it('gets you help', async () => { jest.spyOn(console, 'log') - tauri(['icon']) - expect(!!console.log.mock.calls[0][0]).toBe(true) - jest.clearAllMocks() + const tests = ['--help', '-h', 'invalid command'] + for (const test of tests) { + tauri([test]) + expect(!!console.log.mock.calls[0][0]).toBe(true) + jest.clearAllMocks() + } + }) + it('gets you version', async () => { + jest.spyOn(console, 'log') + const tests = ['--version', '-v'] + const version = require('../../../package.json').version + for (const test of tests) { + tauri([test]) + expect(console.log.mock.calls[0][0]).toBe(version) + jest.clearAllMocks() + } }) })