From 76beaa32f5f3285bc8f7083fff8cd722ba97f60a Mon Sep 17 00:00:00 2001 From: Ameya Advankar Date: Sun, 25 Feb 2018 03:29:51 +0530 Subject: [PATCH] Fix AVA tests and made them mandatory. #2705 Removed obsolete test cases and included unit tests a mandatory step while build and push. Fixed #2703 --- package.json | 2 +- .../unit/keymaps-find-command-by-keys.test.js | 34 ------------------- test/unit/keymaps-normalize.test.js | 16 --------- 3 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 test/unit/keymaps-find-command-by-keys.test.js delete mode 100644 test/unit/keymaps-normalize.test.js diff --git a/package.json b/package.json index 70a6f7ac..ee21ef2c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dev": "webpack -w", "build": "cross-env NODE_ENV=production webpack", "lint": "eslint .", - "test": "yarn run lint", + "test": "yarn run lint && yarn run test:unit", "test:unit": "ava test/unit", "test:unit:watch": "yarn run test:unit -- --watch", "prepush": "yarn test", diff --git a/test/unit/keymaps-find-command-by-keys.test.js b/test/unit/keymaps-find-command-by-keys.test.js deleted file mode 100644 index 27adb88f..00000000 --- a/test/unit/keymaps-find-command-by-keys.test.js +++ /dev/null @@ -1,34 +0,0 @@ -import test from 'ava'; -import findCommandByKeys from '../../app/utils/keymaps/find-command-by-keys'; - -const expectedCommand = 'test-command'; -const expectedLocalizedCommand = 'test-localized-command'; - -const commands = { - 'alt+p+shift': expectedCommand, - 'ç+cmd+ctrl': expectedLocalizedCommand -}; - -test(`returns a command`, t => { - t.is(findCommandByKeys('alt+shift+p', commands), expectedCommand); - - t.is(findCommandByKeys('shift+p+alt', commands), expectedCommand); - - t.is(findCommandByKeys('p+alt+shift', commands), expectedCommand); - - t.is(findCommandByKeys('alt+shift+P', commands), expectedCommand); - - t.is(findCommandByKeys('Shift+P+Alt', commands), expectedCommand); -}); - -test(`returns a localized command`, t => { - t.is(findCommandByKeys('cmd+ctrl+ç', commands), expectedLocalizedCommand); - - t.is(findCommandByKeys('ç+cmd+ctrl', commands), expectedLocalizedCommand); - - t.is(findCommandByKeys('ctrl+ç+cmd', commands), expectedLocalizedCommand); - - t.is(findCommandByKeys('ctrl+Ç+cmd', commands), expectedLocalizedCommand); - - t.is(findCommandByKeys('Cmd+Ctrl+Ç', commands), expectedLocalizedCommand); -}); diff --git a/test/unit/keymaps-normalize.test.js b/test/unit/keymaps-normalize.test.js deleted file mode 100644 index 909d338d..00000000 --- a/test/unit/keymaps-normalize.test.js +++ /dev/null @@ -1,16 +0,0 @@ -import test from 'ava'; -import normalize from '../../app/utils/keymaps/normalize'; - -test(`is normalizing keymaps correctly`, t => { - const notNormalized = 'cmd+alt+o'; - const normalized = 'alt+cmd+o'; - - t.is(normalize(notNormalized), normalized); -}); - -test(`is normalizing localized keymaps correctly`, t => { - const notNormalized = 'cmd+alt+ç'; - const normalized = 'alt+ç+cmd'; - - t.is(normalize(notNormalized), normalized); -});