diff --git a/package.json b/package.json index 627bd78..68a2f14 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,6 @@ "rollup-plugin-terser": "^4.0.2", "semantic-release": "^15.9.16", "semantic-release-alt-publish-dir": "^2.1.1", - "sinon": "^6.3.4", "travis-deploy-once": "^5.0.8" }, "release": { diff --git a/test/Transition-test.js b/test/Transition-test.js index d021370..27fb6ca 100644 --- a/test/Transition-test.js +++ b/test/Transition-test.js @@ -2,7 +2,6 @@ import React from 'react' import ReactDOM from 'react-dom' import { mount } from 'enzyme' -import sinon from 'sinon' import Transition, { UNMOUNTED, @@ -90,13 +89,13 @@ describe('Transition', () => { }) it('should allow addEndListener instead of timeouts', done => { - let listener = sinon.spy((node, end) => setTimeout(end, 0)) + let listener = jest.fn((node, end) => setTimeout(end, 0)) let inst = mount( { - expect(listener.callCount).toEqual(1) + expect(listener).toHaveBeenCalledTimes(1) done() }} > @@ -214,8 +213,9 @@ describe('Transition', () => { }) it('should fire callbacks', done => { - let onEnter = sinon.spy() - let onEntering = sinon.spy() + let callOrder = [] + let onEnter = jest.fn(() => callOrder.push('onEnter')) + let onEntering = jest.fn(() => callOrder.push('onEntering')) expect(wrapper.state('status')).toEqual(EXITED) @@ -227,9 +227,9 @@ describe('Transition', () => { onEntering, onEntered() { - expect(onEnter.calledOnce).toEqual(true) - expect(onEntering.calledOnce).toEqual(true) - expect(onEnter.calledBefore(onEntering)).toEqual(true) + expect(onEnter).toHaveBeenCalledTimes(1) + expect(onEntering).toHaveBeenCalledTimes(1) + expect(callOrder).toEqual(['onEnter', 'onEntering']) done() }, }) @@ -274,8 +274,9 @@ describe('Transition', () => { }) it('should fire callbacks', done => { - let onExit = sinon.spy() - let onExiting = sinon.spy() + let callOrder = [] + let onExit = jest.fn(() => callOrder.push('onExit')) + let onExiting = jest.fn(() => callOrder.push('onExiting')) expect(wrapper.state('status')).toEqual(ENTERED) @@ -287,9 +288,9 @@ describe('Transition', () => { onExiting, onExited() { - expect(onExit.calledOnce).toEqual(true) - expect(onExiting.calledOnce).toEqual(true) - expect(onExit.calledBefore(onExiting)).toEqual(true) + expect(onExit).toHaveBeenCalledTimes(1) + expect(onExiting).toHaveBeenCalledTimes(1) + expect(callOrder).toEqual(['onExit', 'onExiting']) done() }, }) diff --git a/yarn.lock b/yarn.lock index 553820e..f3a54f6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1437,30 +1437,6 @@ dependencies: symbol-observable "^1.2.0" -"@sinonjs/commons@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.0.2.tgz#3e0ac737781627b8844257fadc3d803997d0526e" - dependencies: - type-detect "4.0.8" - -"@sinonjs/formatio@3.0.0", "@sinonjs/formatio@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@sinonjs/formatio/-/formatio-3.0.0.tgz#9d282d81030a03a03fa0c5ce31fd8786a4da311a" - dependencies: - "@sinonjs/samsam" "2.1.0" - -"@sinonjs/samsam@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-2.1.0.tgz#b8b8f5b819605bd63601a6ede459156880f38ea3" - dependencies: - array-from "^2.1.1" - -"@sinonjs/samsam@^2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-2.1.1.tgz#f352621c24c9e9ab2ed293a7655e8d46bfd64c16" - dependencies: - array-from "^2.1.1" - "@storybook/addon-actions@^4.1.4": version "4.1.4" resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-4.1.4.tgz#d6ff166939b0f1b6c2de57c6716503449b17124d" @@ -2312,10 +2288,6 @@ array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" -array-from@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/array-from/-/array-from-2.1.1.tgz#cfe9d8c26628b9dc5aecc62a9f5d8f1f352c1195" - array-ify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" @@ -4337,7 +4309,7 @@ dezalgo@^1.0.0, dezalgo@~1.0.3: asap "^2.0.0" wrappy "1" -diff@^3.2.0, diff@^3.5.0: +diff@^3.2.0: version "3.5.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" @@ -7122,10 +7094,6 @@ jsx-ast-utils@^2.0.1: dependencies: array-includes "^3.0.3" -just-extend@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-3.0.0.tgz#cee004031eaabf6406da03a7b84e4fe9d78ef288" - keycode@^2.2.0: version "2.2.0" resolved "http://storage.mds.yandex.net/get-npm/66641/keycode-2.2.0.tgz#3d0af56dc7b8b8e5cba8d0a97f107204eec22b04" @@ -7386,10 +7354,6 @@ lodash.flattendeep@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" -lodash.get@^4.4.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" - lodash.isarguments@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" @@ -7458,14 +7422,6 @@ lodash@^4.17.11: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" -lolex@^2.3.2: - version "2.7.0" - resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.7.0.tgz#9c087a69ec440e39d3f796767cf1b2cdc43d5ea5" - -lolex@^2.7.4: - version "2.7.5" - resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.7.5.tgz#113001d56bfc7e02d56e36291cc5c413d1aa0733" - longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" @@ -7974,16 +7930,6 @@ nice-try@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" -nise@^1.4.5: - version "1.4.5" - resolved "https://registry.yarnpkg.com/nise/-/nise-1.4.5.tgz#979a97a19c48d627bb53703726ae8d53ce8d4b3e" - dependencies: - "@sinonjs/formatio" "3.0.0" - just-extend "^3.0.0" - lolex "^2.3.2" - path-to-regexp "^1.7.0" - text-encoding "^0.6.4" - no-case@^2.2.0: version "2.3.2" resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" @@ -8863,12 +8809,6 @@ path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" -path-to-regexp@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" - dependencies: - isarray "0.0.1" - path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" @@ -10507,20 +10447,6 @@ signale@^1.2.1: figures "^2.0.0" pkg-conf "^2.1.0" -sinon@^6.3.4: - version "6.3.4" - resolved "https://registry.yarnpkg.com/sinon/-/sinon-6.3.4.tgz#6f076d7ddcf381af6c16468ac83d30333a756ec8" - dependencies: - "@sinonjs/commons" "^1.0.2" - "@sinonjs/formatio" "^3.0.0" - "@sinonjs/samsam" "^2.1.1" - diff "^3.5.0" - lodash.get "^4.4.2" - lolex "^2.7.4" - nise "^1.4.5" - supports-color "^5.5.0" - type-detect "^4.0.8" - sisteransi@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-0.1.1.tgz#5431447d5f7d1675aac667ccd0b865a4994cb3ce" @@ -11142,10 +11068,6 @@ test-exclude@^4.2.1: read-pkg-up "^1.0.1" require-main-filename "^1.0.1" -text-encoding@^0.6.4: - version "0.6.4" - resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19" - text-extensions@^1.0.0: version "1.7.0" resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.7.0.tgz#faaaba2625ed746d568a23e4d0aacd9bf08a8b39" @@ -11317,10 +11239,6 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@4.0.8, type-detect@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - type-is@~1.6.15, type-is@~1.6.16: version "1.6.16" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194"