فهرست منبع

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

Lucas Fernandes Gonçalves Nogueira 5 سال پیش
والد
کامیت
7dc2036095
1فایلهای تغییر یافته به همراه16 افزوده شده و 3 حذف شده
  1. 16 3
      cli/tauri.js/test/jest/__tests__/tauri.spec.js

+ 16 - 3
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()
+    }
   })
 })