From cfd018c120d24e8e986311131dbfc621f9e1dd65 Mon Sep 17 00:00:00 2001 From: vvo Date: Fri, 17 Mar 2017 16:38:20 +0100 Subject: [PATCH] chore(test): fix tests, add linting in test --- package.json | 7 +- src/lib/__tests__/DocSearch-test.js | 9 +-- yarn.lock | 112 ++++------------------------ 3 files changed, 21 insertions(+), 107 deletions(-) diff --git a/package.json b/package.json index 026f3639..9b41a83e 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "release": "./scripts/release", "release:beta": "./scripts/release-beta", "lint": "eslint .", - "test": "jest --coverage", + "test": "jest --coverage && npm run lint", "test:watch": "jest --watch", "gh-pages": "./scripts/gh-pages", "precommit": "lint-staged" @@ -46,17 +46,18 @@ "cssnano": "^3.7.0", "doctoc": "^1.3.0", "eslint": "^3.17.1", - "eslint-config-algolia": "^6.0.1", + "eslint-config-algolia": "^7.0.1", "eslint-config-prettier": "^1.5.0", "eslint-import-resolver-webpack": "^0.8.1", "eslint-plugin-algolia": "^1.5.0", "eslint-plugin-import": "^2.2.0", "eslint-plugin-jest": "^19.0.1", - "expect": "^1.20.1", "gh-pages": "^0.12.0", + "husky": "^0.13.2", "jest": "^19.0.2", "jsdom": "^9.12.0", "json": "^9.0.6", + "lint-staged": "^3.4.0", "mversion": "^1.10.1", "nd": "^1.2.0", "node-sass": "^4.5.0", diff --git a/src/lib/__tests__/DocSearch-test.js b/src/lib/__tests__/DocSearch-test.js index e767a9c0..b0396147 100644 --- a/src/lib/__tests__/DocSearch-test.js +++ b/src/lib/__tests__/DocSearch-test.js @@ -1,6 +1,5 @@ /* eslint no-new:0 */ /* eslint-disable max-len */ -import expect from 'expect'; import sinon from 'sinon'; import $ from '../zepto.js'; import DocSearch from '../DocSearch.js'; @@ -346,7 +345,7 @@ describe('DocSearch', () => { // When // Then - expect(actual).toBeA('function'); + expect(actual).toBeInstanceOf(Function); }); describe('the returned function', () => { @@ -371,7 +370,7 @@ describe('DocSearch', () => { }); describe('handleSelected', () => { - it.only('should change the location', () => { + it('should change the location', () => { // Given const options = { apiKey: 'key', @@ -406,7 +405,7 @@ describe('DocSearch', () => { ds.autocomplete.trigger('autocomplete:shown'); expect($('.algolia-autocomplete').attr('class')).toEqual( - 'algolia-autocomplete algolia-autocomplete-left' + 'algolia-autocomplete algolia-autocomplete-right' ); }); }); @@ -1040,7 +1039,7 @@ describe('DocSearch', () => { const actual = DocSearch.getSuggestionTemplate(); // Then - expect(actual).toBeA('function'); + expect(actual).toBeInstanceOf(Function); }); describe('returned function', () => { let Hogan; diff --git a/yarn.lock b/yarn.lock index 24a1ca8d..e8e3739f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1951,7 +1951,7 @@ defaults@^1.0.0, defaults@^1.0.3: dependencies: clone "^1.0.2" -define-properties@^1.1.2, define-properties@~1.1.2: +define-properties@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" dependencies: @@ -2193,7 +2193,7 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.6.1, es-abstract@^1.7.0: +es-abstract@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.7.0.tgz#dfade774e01bfcd97f96180298c449c8623fb94c" dependencies: @@ -2294,16 +2294,17 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-algolia@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/eslint-config-algolia/-/eslint-config-algolia-6.0.1.tgz#f8561168bac35b368d980c31e3ba8d0a511eb217" +eslint-config-algolia@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/eslint-config-algolia/-/eslint-config-algolia-7.0.1.tgz#6199a5037460f17f2beab55cd417081a6cab6716" dependencies: babel-eslint "^7.0.0" eslint "^3.8.0" - eslint-import-resolver-webpack "^0.6.0" + eslint-config-prettier "^1.5.0" eslint-plugin-import "^2.0.1" - eslint-plugin-jasmine "^1.8.1" + eslint-plugin-jest "^19.0.1" eslint-plugin-react "^6.4.1" + prettier "^0.22.0" eslint-config-prettier@^1.5.0: version "1.5.0" @@ -2319,22 +2320,6 @@ eslint-import-resolver-node@^0.2.0: object-assign "^4.0.1" resolve "^1.1.6" -eslint-import-resolver-webpack@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.6.0.tgz#cfa48c727b633eb523e29ef019750b2106d0f609" - dependencies: - array-find "^1.0.0" - debug "^2.2.0" - enhanced-resolve "~0.9.0" - find-root "^0.1.1" - interpret "^1.0.0" - is-absolute "^0.2.3" - lodash.get "^3.7.0" - node-libs-browser "^1.0.0" - object-assign "^4.1.0" - resolve "^1.1.7" - semver "^5.3.0" - eslint-import-resolver-webpack@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.8.1.tgz#c7f8b4d5bd3c5b489457e5728c5db1c4ffbac9aa" @@ -2377,10 +2362,6 @@ eslint-plugin-import@^2.0.1, eslint-plugin-import@^2.2.0: minimatch "^3.0.3" pkg-up "^1.0.0" -eslint-plugin-jasmine@^1.8.1: - version "1.9.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jasmine/-/eslint-plugin-jasmine-1.9.0.tgz#99578cd3009ec137c8d3b8a0c25c32581168bba5" - eslint-plugin-jest@^19.0.1: version "19.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-19.0.1.tgz#42a420e90e81aa74e162c16166e43a31b890eece" @@ -2545,18 +2526,6 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -expect@^1.20.1: - version "1.20.2" - resolved "https://registry.yarnpkg.com/expect/-/expect-1.20.2.tgz#d458fe4c56004036bae3232416a3f6361f04f965" - dependencies: - define-properties "~1.1.2" - has "^1.0.1" - is-equal "^1.5.1" - is-regex "^1.0.3" - object-inspect "^1.1.0" - object-keys "^1.0.9" - tmatch "^2.0.1" - express@^4.13.3: version "4.14.1" resolved "https://registry.yarnpkg.com/express/-/express-4.14.1.tgz#646c237f766f148c2120aff073817b9e4d7e0d33" @@ -3044,7 +3013,7 @@ glob@5.x: once "^1.3.0" path-is-absolute "^1.0.0" -glob@7.1.1, glob@~7.1.1: +glob@7.1.1, glob@^7.0.5, glob@~7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: @@ -3074,7 +3043,7 @@ glob@^6.0.0: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5: +glob@^7.0.0, glob@^7.0.3: version "7.0.5" resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" dependencies: @@ -3507,22 +3476,12 @@ is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" -is-arrow-function@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/is-arrow-function/-/is-arrow-function-2.0.3.tgz#29be2c2d8d9450852b8bbafb635ba7b8d8e87ec2" - dependencies: - is-callable "^1.0.4" - is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" dependencies: binary-extensions "^1.0.0" -is-boolean-object@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.0.tgz#98f8b28030684219a95f375cfbd88ce3405dff93" - is-buffer@^1.0.2: version "1.1.4" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b" @@ -3533,7 +3492,7 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" -is-callable@^1.0.4, is-callable@^1.1.1, is-callable@^1.1.3: +is-callable@^1.1.1, is-callable@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" @@ -3561,22 +3520,6 @@ is-equal-shallow@^0.1.3: dependencies: is-primitive "^2.0.0" -is-equal@^1.5.1: - version "1.5.5" - resolved "https://registry.yarnpkg.com/is-equal/-/is-equal-1.5.5.tgz#5e85f1957e052883247feb386965a3bba15fbb3d" - dependencies: - has "^1.0.1" - is-arrow-function "^2.0.3" - is-boolean-object "^1.0.0" - is-callable "^1.1.3" - is-date-object "^1.0.1" - is-generator-function "^1.0.6" - is-number-object "^1.0.3" - is-regex "^1.0.3" - is-string "^1.0.4" - is-symbol "^1.0.1" - object.entries "^1.0.4" - is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -3605,10 +3548,6 @@ is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" -is-generator-function@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.6.tgz#9e71653cd15fff341c79c4151460a131d31e9fc4" - is-glob@^2.0.0, is-glob@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" @@ -3638,10 +3577,6 @@ is-npm@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" -is-number-object@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.3.tgz#f265ab89a9f445034ef6aff15a8f00b00f551799" - is-number@^2.0.2, is-number@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" @@ -3714,10 +3649,6 @@ is-stream@^1.0.0, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" -is-string@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.4.tgz#cc3a9b69857d621e963725a24caeec873b826e64" - is-subset@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6" @@ -5175,11 +5106,7 @@ object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" -object-inspect@^1.1.0: - version "1.2.1" - resolved "http://registry.npmjs.org/object-inspect/-/object-inspect-1.2.1.tgz#3b62226eb8f6d441751c7d8f22a20ff80ac9dc3f" - -object-keys@^1.0.10, object-keys@^1.0.11, object-keys@^1.0.8, object-keys@^1.0.9, object-keys@~1.0.0: +object-keys@^1.0.10, object-keys@^1.0.11, object-keys@^1.0.8, object-keys@~1.0.0: version "1.0.11" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" @@ -5191,15 +5118,6 @@ object.assign@^4.0.4: function-bind "^1.1.0" object-keys "^1.0.10" -object.entries@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.0.4.tgz#1bf9a4dd2288f5b33f3a993d257661f05d161a5f" - dependencies: - define-properties "^1.1.2" - es-abstract "^1.6.1" - function-bind "^1.1.0" - has "^1.0.1" - object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" @@ -6339,7 +6257,7 @@ resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@^1.1.0, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.2.0: +resolve@^1.1.0, resolve@^1.1.6, resolve@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" @@ -7029,10 +6947,6 @@ timespan@2.x.x: version "2.3.0" resolved "https://registry.yarnpkg.com/timespan/-/timespan-2.3.0.tgz#4902ce040bd13d845c8f59b27e9d59bad6f39929" -tmatch@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/tmatch/-/tmatch-2.0.1.tgz#0c56246f33f30da1b8d3d72895abaf16660f38cf" - tmpl@1.0.x: version "1.0.4" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"