test(tauri.js) add tests for --version option

This commit is contained in:
Lucas Fernandes Gonçalves Nogueira
2019-12-24 09:54:04 -03:00
parent c2b3ac4b05
commit 7dc2036095

View File

@@ -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()
}
})
})