diff --git a/karma.conf.js b/karma.conf.js index 0585210..8cdfd16 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -61,7 +61,7 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], + browsers: ['jsdom'], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index c230754..a0836b5 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -2,6 +2,12 @@ "name": "ely-by-account", "version": "1.0.0", "dependencies": { + "abab": { + "version": "1.0.3", + "from": "abab@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.3.tgz", + "dev": true + }, "abbrev": { "version": "1.0.9", "from": "abbrev@>=1.0.0 <2.0.0", @@ -40,6 +46,20 @@ "resolved": "https://registry.npmjs.org/acorn-babel/-/acorn-babel-0.11.1-38.tgz", "dev": true }, + "acorn-globals": { + "version": "1.0.9", + "from": "acorn-globals@>=1.0.4 <2.0.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz", + "dev": true, + "dependencies": { + "acorn": { + "version": "2.7.0", + "from": "acorn@^2.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", + "dev": true + } + } + }, "acorn-jsx": { "version": "3.0.1", "from": "acorn-jsx@>=3.0.0 <4.0.0", @@ -168,6 +188,12 @@ "resolved": "https://registry.npmjs.org/array-changes-async/-/array-changes-async-3.0.0.tgz", "dev": true }, + "array-equal": { + "version": "1.0.0", + "from": "array-equal@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "dev": true + }, "array-find-index": { "version": "1.0.2", "from": "array-find-index@>=1.0.1 <2.0.0", @@ -1697,6 +1723,12 @@ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.2.tgz", "dev": true }, + "content-type-parser": { + "version": "1.0.1", + "from": "content-type-parser@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.1.tgz", + "dev": true + }, "convert-source-map": { "version": "1.3.0", "from": "convert-source-map@>=1.1.0 <2.0.0", @@ -1822,6 +1854,18 @@ "resolved": "https://registry.npmjs.org/csso/-/csso-2.2.1.tgz", "dev": true }, + "cssom": { + "version": "0.3.1", + "from": "cssom@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.1.tgz", + "dev": true + }, + "cssstyle": { + "version": "0.2.37", + "from": "cssstyle@>=0.2.36 <0.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", + "dev": true + }, "cubic2quad": { "version": "1.1.0", "from": "cubic2quad@>=1.0.0 <2.0.0", @@ -2266,12 +2310,6 @@ "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.4.tgz", "dev": true }, - "es6-promise": { - "version": "4.0.5", - "from": "es6-promise@>=4.0.3 <4.1.0", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz", - "dev": true - }, "es6-set": { "version": "0.1.4", "from": "es6-set@>=0.1.3 <0.2.0", @@ -2314,6 +2352,27 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "dev": true }, + "escodegen": { + "version": "1.8.1", + "from": "escodegen@>=1.6.1 <2.0.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "dev": true, + "dependencies": { + "estraverse": { + "version": "1.9.3", + "from": "estraverse@>=1.9.1 <2.0.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", + "dev": true + }, + "source-map": { + "version": "0.2.0", + "from": "source-map@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "dev": true, + "optional": true + } + } + }, "escope": { "version": "3.6.0", "from": "escope@>=3.6.0 <4.0.0", @@ -2541,38 +2600,6 @@ "resolved": "https://registry.npmjs.org/extract-text-webpack-plugin/-/extract-text-webpack-plugin-1.0.1.tgz", "dev": true }, - "extract-zip": { - "version": "1.5.0", - "from": "extract-zip@>=1.5.0 <1.6.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.5.0.tgz", - "dev": true, - "dependencies": { - "concat-stream": { - "version": "1.5.0", - "from": "concat-stream@1.5.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.0.tgz", - "dev": true - }, - "debug": { - "version": "0.7.4", - "from": "debug@0.7.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", - "dev": true - }, - "mkdirp": { - "version": "0.5.0", - "from": "mkdirp@0.5.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", - "dev": true - }, - "readable-stream": { - "version": "2.0.6", - "from": "readable-stream@>=2.0.0 <2.1.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "dev": true - } - } - }, "extsprintf": { "version": "1.0.2", "from": "extsprintf@1.0.2", @@ -2622,12 +2649,6 @@ } } }, - "fd-slicer": { - "version": "1.0.1", - "from": "fd-slicer@>=1.0.1 <1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "dev": true - }, "figures": { "version": "1.7.0", "from": "figures@>=1.3.5 <2.0.0", @@ -2799,12 +2820,6 @@ "dev": true, "optional": true }, - "fs-extra": { - "version": "0.30.0", - "from": "fs-extra@>=0.30.0 <0.31.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "dev": true - }, "fs-readdir-recursive": { "version": "0.1.2", "from": "fs-readdir-recursive@>=0.1.0 <0.2.0", @@ -3026,12 +3041,6 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "dev": true }, - "hasha": { - "version": "2.2.0", - "from": "hasha@>=2.2.0 <2.3.0", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", - "dev": true - }, "hawk": { "version": "3.1.3", "from": "hawk@>=3.1.3 <3.2.0", @@ -3084,6 +3093,12 @@ "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.1.tgz", "dev": true }, + "html-encoding-sniffer": { + "version": "1.0.1", + "from": "html-encoding-sniffer@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.1.tgz", + "dev": true + }, "html-loader": { "version": "0.4.4", "from": "html-loader@>=0.4.3 <0.5.0", @@ -3630,6 +3645,20 @@ "dev": true, "optional": true }, + "jsdom": { + "version": "9.8.3", + "from": "jsdom@latest", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-9.8.3.tgz", + "dev": true, + "dependencies": { + "acorn": { + "version": "2.7.0", + "from": "acorn@>=2.4.0 <3.0.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", + "dev": true + } + } + }, "jsesc": { "version": "1.3.0", "from": "jsesc@>=1.3.0 <2.0.0", @@ -3811,6 +3840,12 @@ } } }, + "karma-jsdom-launcher": { + "version": "5.0.0", + "from": "karma-jsdom-launcher@latest", + "resolved": "https://registry.npmjs.org/karma-jsdom-launcher/-/karma-jsdom-launcher-5.0.0.tgz", + "dev": true + }, "karma-mocha": { "version": "1.3.0", "from": "karma-mocha@>=1.0.0 <2.0.0", @@ -3831,12 +3866,6 @@ "resolved": "https://registry.npmjs.org/karma-nyan-reporter/-/karma-nyan-reporter-0.2.4.tgz", "dev": true }, - "karma-phantomjs-launcher": { - "version": "1.0.2", - "from": "karma-phantomjs-launcher@*", - "resolved": "https://registry.npmjs.org/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.2.tgz", - "dev": true - }, "karma-sinon": { "version": "1.0.5", "from": "karma-sinon@>=1.0.4 <2.0.0", @@ -3875,24 +3904,12 @@ } } }, - "kew": { - "version": "0.7.0", - "from": "kew@>=0.7.0 <0.8.0", - "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", - "dev": true - }, "kind-of": { "version": "3.0.4", "from": "kind-of@>=3.0.2 <4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.0.4.tgz", "dev": true }, - "klaw": { - "version": "1.3.1", - "from": "klaw@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "dev": true - }, "lazy-cache": { "version": "1.0.4", "from": "lazy-cache@>=1.0.3 <2.0.0", @@ -4671,6 +4688,12 @@ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "dev": true }, + "nwmatcher": { + "version": "1.3.9", + "from": "nwmatcher@>=1.3.7 <2.0.0", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.3.9.tgz", + "dev": true + }, "oauth-sign": { "version": "0.8.2", "from": "oauth-sign@>=0.8.1 <0.9.0", @@ -4866,6 +4889,12 @@ "resolved": "https://registry.npmjs.org/parse-key/-/parse-key-0.2.1.tgz", "dev": true }, + "parse5": { + "version": "1.5.1", + "from": "parse5@>=1.5.1 <2.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", + "dev": true + }, "parsejson": { "version": "0.0.1", "from": "parsejson@0.0.1", @@ -4964,23 +4993,11 @@ "resolved": "https://registry.npmjs.org/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz", "dev": true }, - "pend": { - "version": "1.2.0", - "from": "pend@>=1.2.0 <1.3.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "dev": true - }, "performance-now": { "version": "0.2.0", "from": "performance-now@>=0.2.0 <0.3.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz" }, - "phantomjs-prebuilt": { - "version": "2.1.13", - "from": "phantomjs-prebuilt@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.13.tgz", - "dev": true - }, "pify": { "version": "2.3.0", "from": "pify@>=2.0.0 <3.0.0", @@ -5928,12 +5945,6 @@ "resolved": "https://registry.npmjs.org/request/-/request-2.74.0.tgz", "dev": true }, - "request-progress": { - "version": "2.0.1", - "from": "request-progress@>=2.0.1 <2.1.0", - "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", - "dev": true - }, "require-directory": { "version": "2.1.1", "from": "require-directory@>=2.1.1 <3.0.0", @@ -6641,6 +6652,12 @@ "from": "symbol-observable@>=1.0.2 <2.0.0", "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz" }, + "symbol-tree": { + "version": "3.1.4", + "from": "symbol-tree@>=3.1.0 <4.0.0", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.1.4.tgz", + "dev": true + }, "systemjs": { "version": "0.19.41", "from": "systemjs@0.19.41", @@ -6717,12 +6734,6 @@ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "dev": true }, - "throttleit": { - "version": "1.0.0", - "from": "throttleit@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "dev": true - }, "through": { "version": "2.3.8", "from": "through@>=2.3.6 <3.0.0", @@ -6792,6 +6803,12 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", "dev": true }, + "tr46": { + "version": "0.0.3", + "from": "tr46@>=0.0.3 <0.1.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "dev": true + }, "traceur": { "version": "0.0.105", "from": "traceur@0.0.105", @@ -7246,6 +7263,12 @@ "resolved": "https://registry.npmjs.org/webfonts-generator/-/webfonts-generator-0.3.5.tgz", "dev": true }, + "webidl-conversions": { + "version": "3.0.1", + "from": "webidl-conversions@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "dev": true + }, "webpack": { "version": "1.13.3", "from": "webpack@>=1.12.9 <2.0.0", @@ -7368,11 +7391,23 @@ "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.1.tgz", "dev": true }, + "whatwg-encoding": { + "version": "1.0.1", + "from": "whatwg-encoding@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.1.tgz", + "dev": true + }, "whatwg-fetch": { "version": "2.0.1", "from": "whatwg-fetch@2.0.1", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.1.tgz" }, + "whatwg-url": { + "version": "3.1.0", + "from": "whatwg-url@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-3.1.0.tgz", + "dev": true + }, "when": { "version": "3.7.7", "from": "when@>=3.7.5 <4.0.0", @@ -7471,6 +7506,12 @@ "resolved": "https://registry.npmjs.org/xml-char-classes/-/xml-char-classes-1.0.0.tgz", "dev": true }, + "xml-name-validator": { + "version": "2.0.1", + "from": "xml-name-validator@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz", + "dev": true + }, "xmldom": { "version": "0.1.22", "from": "xmldom@>=0.1.22 <0.2.0", @@ -7521,12 +7562,6 @@ } } }, - "yauzl": { - "version": "2.4.1", - "from": "yauzl@2.4.1", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", - "dev": true - }, "yeast": { "version": "0.1.2", "from": "yeast@0.1.2", diff --git a/package.json b/package.json index 53b2886..483eedd 100644 --- a/package.json +++ b/package.json @@ -64,18 +64,18 @@ "html-loader": "^0.4.3", "html-webpack-plugin": "^2.0.0", "imports-loader": "^0.6.5", + "jsdom": "^9.8.3", "json-loader": "^0.5.4", "karma": "^1.1.0", + "karma-jsdom-launcher": "^5.0.0", "karma-mocha": "^1.0.0", "karma-nyan-reporter": "^0.2.3", - "karma-phantomjs-launcher": "*", "karma-sinon": "^1.0.4", "karma-sourcemap-loader": "*", "karma-webpack": "^1.5.1", "loader-utils": "^0.2.15", "mocha": "^3.0.2", "node-sass": "^3.4.2", - "phantomjs-prebuilt": "^2.0.0", "postcss-import": "^8.1.2", "postcss-loader": "^1.0.0", "postcss-scss": "^0.4.0", diff --git a/tests/index.js b/tests/index.js index 89552f2..05f13ad 100644 --- a/tests/index.js +++ b/tests/index.js @@ -3,6 +3,24 @@ import 'polyfills'; import expect from 'unexpected'; expect.use(require('unexpected-sinon')); +if (!window.localStorage) { + window.localStorage = { + getItem(key) { + return this[key]; + }, + setItem(key, value) { + this[key] = value; + }, + removeItem(key) { + delete this[key]; + } + }; + + window.sessionStorage = { + ...window.localStorage + }; +} + // require all modules ending in "_test" from the // current directory and all subdirectories const testsContext = require.context('.', true, /\.test\.jsx?$/); diff --git a/tests/services/authFlow/AuthFlow.test.js b/tests/services/authFlow/AuthFlow.test.js index 7d00a2c..ac8eee7 100644 --- a/tests/services/authFlow/AuthFlow.test.js +++ b/tests/services/authFlow/AuthFlow.test.js @@ -30,8 +30,8 @@ describe('AuthFlow', () => { }); it('should not allow to mutate actions', () => { - expect(() => flow.actions.foo = 'bar', 'to throw', /readonly/); - expect(() => flow.actions.test = 'hacked', 'to throw', /readonly/); + expect(() => flow.actions.foo = 'bar', 'to throw', /readonly|not extensible/); + expect(() => flow.actions.test = 'hacked', 'to throw', /read ?only/); }); describe('#setStore', () => {