diff --git a/package-lock.json b/package-lock.json
index 06d71df..7b96b69 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -40,7 +40,7 @@
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-test-renderer": "^16.2.0",
- "sinon": "^1.17.6",
+ "sinon": "^16.1.0",
"stylus": "^0.60.0"
},
"engines": {
@@ -2325,6 +2325,50 @@
"node": ">= 8"
}
},
+ "node_modules/@sinonjs/commons": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz",
+ "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==",
+ "dev": true,
+ "dependencies": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "node_modules/@sinonjs/fake-timers": {
+ "version": "10.3.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz",
+ "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==",
+ "dev": true,
+ "dependencies": {
+ "@sinonjs/commons": "^3.0.0"
+ }
+ },
+ "node_modules/@sinonjs/samsam": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.0.tgz",
+ "integrity": "sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew==",
+ "dev": true,
+ "dependencies": {
+ "@sinonjs/commons": "^2.0.0",
+ "lodash.get": "^4.4.2",
+ "type-detect": "^4.0.8"
+ }
+ },
+ "node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz",
+ "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==",
+ "dev": true,
+ "dependencies": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "node_modules/@sinonjs/text-encoding": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz",
+ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==",
+ "dev": true
+ },
"node_modules/@tootallnate/once": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
@@ -4608,15 +4652,6 @@
"node": ">= 0.12"
}
},
- "node_modules/formatio": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz",
- "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=",
- "dev": true,
- "dependencies": {
- "samsam": "~1.1"
- }
- },
"node_modules/formidable": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.2.tgz",
@@ -5843,6 +5878,12 @@
"node": ">=4.0"
}
},
+ "node_modules/just-extend": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz",
+ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
+ "dev": true
+ },
"node_modules/kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -5926,6 +5967,12 @@
"integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=",
"dev": true
},
+ "node_modules/lodash.get": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
+ "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==",
+ "dev": true
+ },
"node_modules/lodash.isequal": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
@@ -6028,12 +6075,6 @@
"node": ">=8"
}
},
- "node_modules/lolex": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz",
- "integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=",
- "dev": true
- },
"node_modules/loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@@ -6520,6 +6561,28 @@
"nearleyc": "bin/nearleyc.js"
}
},
+ "node_modules/nise": {
+ "version": "5.1.4",
+ "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.4.tgz",
+ "integrity": "sha512-8+Ib8rRJ4L0o3kfmyVCL7gzrohyDe0cMFTBa2d364yIrEGMEoetznKJx899YxjybU6bL9SQkYPSBBs1gyYs8Xg==",
+ "dev": true,
+ "dependencies": {
+ "@sinonjs/commons": "^2.0.0",
+ "@sinonjs/fake-timers": "^10.0.2",
+ "@sinonjs/text-encoding": "^0.7.1",
+ "just-extend": "^4.0.2",
+ "path-to-regexp": "^1.7.0"
+ }
+ },
+ "node_modules/nise/node_modules/@sinonjs/commons": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz",
+ "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==",
+ "dev": true,
+ "dependencies": {
+ "type-detect": "4.0.8"
+ }
+ },
"node_modules/node-releases": {
"version": "2.0.13",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
@@ -7500,12 +7563,6 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
},
- "node_modules/samsam": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz",
- "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=",
- "dev": true
- },
"node_modules/sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
@@ -7598,18 +7655,51 @@
}
},
"node_modules/sinon": {
- "version": "1.17.7",
- "resolved": "https://registry.npmjs.org/sinon/-/sinon-1.17.7.tgz",
- "integrity": "sha1-RUKk9JugxFwF6y6d2dID4rjv4L8=",
+ "version": "16.1.0",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-16.1.0.tgz",
+ "integrity": "sha512-ZSgzF0vwmoa8pq0GEynqfdnpEDyP1PkYmEChnkjW0Vyh8IDlyFEJ+fkMhCP0il6d5cJjPl2PUsnUSAuP5sttOQ==",
"dev": true,
"dependencies": {
- "formatio": "1.1.1",
- "lolex": "1.3.2",
- "samsam": "1.1.2",
- "util": ">=0.10.3 <1"
+ "@sinonjs/commons": "^3.0.0",
+ "@sinonjs/fake-timers": "^10.3.0",
+ "@sinonjs/samsam": "^8.0.0",
+ "diff": "^5.1.0",
+ "nise": "^5.1.4",
+ "supports-color": "^7.2.0"
},
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/sinon"
+ }
+ },
+ "node_modules/sinon/node_modules/diff": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz",
+ "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==",
+ "dev": true,
"engines": {
- "node": ">=0.1.103"
+ "node": ">=0.3.1"
+ }
+ },
+ "node_modules/sinon/node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/sinon/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
}
},
"node_modules/slash": {
@@ -8184,20 +8274,6 @@
"requires-port": "^1.0.0"
}
},
- "node_modules/util": {
- "version": "0.12.3",
- "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz",
- "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==",
- "dev": true,
- "dependencies": {
- "inherits": "^2.0.3",
- "is-arguments": "^1.0.4",
- "is-generator-function": "^1.0.7",
- "is-typed-array": "^1.1.3",
- "safe-buffer": "^5.1.2",
- "which-typed-array": "^1.1.2"
- }
- },
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@@ -10113,6 +10189,52 @@
"fastq": "^1.6.0"
}
},
+ "@sinonjs/commons": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz",
+ "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "@sinonjs/fake-timers": {
+ "version": "10.3.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz",
+ "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^3.0.0"
+ }
+ },
+ "@sinonjs/samsam": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.0.tgz",
+ "integrity": "sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^2.0.0",
+ "lodash.get": "^4.4.2",
+ "type-detect": "^4.0.8"
+ },
+ "dependencies": {
+ "@sinonjs/commons": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz",
+ "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ }
+ }
+ },
+ "@sinonjs/text-encoding": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz",
+ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==",
+ "dev": true
+ },
"@tootallnate/once": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
@@ -11913,15 +12035,6 @@
"mime-types": "^2.1.12"
}
},
- "formatio": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz",
- "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=",
- "dev": true,
- "requires": {
- "samsam": "~1.1"
- }
- },
"formidable": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.2.tgz",
@@ -12851,6 +12964,12 @@
"object.assign": "^4.1.3"
}
},
+ "just-extend": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz",
+ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
+ "dev": true
+ },
"kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -12922,6 +13041,12 @@
"integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=",
"dev": true
},
+ "lodash.get": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
+ "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==",
+ "dev": true
+ },
"lodash.isequal": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
@@ -12999,12 +13124,6 @@
}
}
},
- "lolex": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz",
- "integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=",
- "dev": true
- },
"loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@@ -13387,6 +13506,30 @@
"semver": "^5.4.1"
}
},
+ "nise": {
+ "version": "5.1.4",
+ "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.4.tgz",
+ "integrity": "sha512-8+Ib8rRJ4L0o3kfmyVCL7gzrohyDe0cMFTBa2d364yIrEGMEoetznKJx899YxjybU6bL9SQkYPSBBs1gyYs8Xg==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^2.0.0",
+ "@sinonjs/fake-timers": "^10.0.2",
+ "@sinonjs/text-encoding": "^0.7.1",
+ "just-extend": "^4.0.2",
+ "path-to-regexp": "^1.7.0"
+ },
+ "dependencies": {
+ "@sinonjs/commons": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz",
+ "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ }
+ }
+ },
"node-releases": {
"version": "2.0.13",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
@@ -14159,12 +14302,6 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
},
- "samsam": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz",
- "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=",
- "dev": true
- },
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
@@ -14239,15 +14376,40 @@
}
},
"sinon": {
- "version": "1.17.7",
- "resolved": "https://registry.npmjs.org/sinon/-/sinon-1.17.7.tgz",
- "integrity": "sha1-RUKk9JugxFwF6y6d2dID4rjv4L8=",
+ "version": "16.1.0",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-16.1.0.tgz",
+ "integrity": "sha512-ZSgzF0vwmoa8pq0GEynqfdnpEDyP1PkYmEChnkjW0Vyh8IDlyFEJ+fkMhCP0il6d5cJjPl2PUsnUSAuP5sttOQ==",
"dev": true,
"requires": {
- "formatio": "1.1.1",
- "lolex": "1.3.2",
- "samsam": "1.1.2",
- "util": ">=0.10.3 <1"
+ "@sinonjs/commons": "^3.0.0",
+ "@sinonjs/fake-timers": "^10.3.0",
+ "@sinonjs/samsam": "^8.0.0",
+ "diff": "^5.1.0",
+ "nise": "^5.1.4",
+ "supports-color": "^7.2.0"
+ },
+ "dependencies": {
+ "diff": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz",
+ "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
}
},
"slash": {
@@ -14675,20 +14837,6 @@
"requires-port": "^1.0.0"
}
},
- "util": {
- "version": "0.12.3",
- "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz",
- "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==",
- "dev": true,
- "requires": {
- "inherits": "^2.0.3",
- "is-arguments": "^1.0.4",
- "is-generator-function": "^1.0.7",
- "is-typed-array": "^1.1.3",
- "safe-buffer": "^5.1.2",
- "which-typed-array": "^1.1.2"
- }
- },
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
diff --git a/package.json b/package.json
index fbbe19d..a1d0319 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-test-renderer": "^16.2.0",
- "sinon": "^1.17.6",
+ "sinon": "^16.1.0",
"stylus": "^0.60.0"
},
"dependencies": {
diff --git a/test/display-name-slug-editor.test.js b/test/display-name-slug-editor.test.js
index 7b936a6..07161d8 100644
--- a/test/display-name-slug-editor.test.js
+++ b/test/display-name-slug-editor.test.js
@@ -61,17 +61,18 @@ describe('', function() {
});
describe('component lifecycle', function() {
- const getResourceUrlSpy = sinon.spy(DisplayNameSlugEditor.prototype, 'getResourceUrl');
+ let getResourceUrlSpy;
const origin = 'https://www.test.com';
before(function() {
+ getResourceUrlSpy = sinon.spy(DisplayNameSlugEditor.prototype, 'getResourceUrl');
wrapper = mount();
});
describe('componentDidMount', function() {
after(function() {
- getResourceUrlSpy.reset();
+ getResourceUrlSpy.resetHistory();
});
it('should call getResourceUrl', function() {
@@ -117,9 +118,10 @@ describe('', function() {
let button;
const onChangeSpy = sinon.spy(DisplayNameSlugEditor.prototype, 'handleInputChange');
const undoNameChangeSpy = sinon.spy(DisplayNameSlugEditor.prototype, 'undoNameChange');
- const warnURLChangeSpy = sinon.spy(DisplayNameSlugEditor.prototype, 'warnURLChange');
+ let warnURLChangeSpy;
before(function() {
+ warnURLChangeSpy = sinon.spy(DisplayNameSlugEditor.prototype, 'warnURLChange');
wrapper = mount();
input = wrapper.find('input[type="text"]');
value = 'Lorem ipsum';
@@ -136,7 +138,7 @@ describe('', function() {
expect(warnURLChangeSpy.calledOnce).to.be.true;
expect(warnURLChangeSpy.calledWith(resource, value)).to.be.true;
expect(warnURLChangeSpy.calledAfter(onChangeSpy)).to.be.true;
- warnURLChangeSpy.reset();
+ warnURLChangeSpy.resetHistory();
});
it('warns the user about URL changes', function() {
@@ -159,7 +161,7 @@ describe('', function() {
input.simulate('change', { target: { value: 'a new name' }});
expect(warnURLChangeSpy.calledOnce).to.be.true;
expect(wrapper.state().warn).to.be.false;
- warnURLChangeSpy.reset();
+ warnURLChangeSpy.resetHistory();
});
it('does not warn the user about URL changes if the slug includes "untitled-organization"', function() {
diff --git a/test/paginator.test.js b/test/paginator.test.js
index 7a3c193..8ad438e 100644
--- a/test/paginator.test.js
+++ b/test/paginator.test.js
@@ -99,15 +99,16 @@ describe('Paginator', function() {
describe('with props page, pageKey and router provided', function() {
let wrapper;
- const router = { push() {} };
- const spy = sinon.spy(router, 'push');
+ const router = {
+ push: sinon.spy()
+ };
beforeEach(function() {
wrapper = mount();
});
afterEach(function() {
- spy.reset();
+ router.push.resetHistory();
});
it('should start on page', function() {
@@ -115,42 +116,39 @@ describe('Paginator', function() {
});
it('should add pageKey to param onChange', function() {
wrapper.find('#next').simulate('click');
- expect(Object.keys(spy.args[0][0].query)).to.include('testPage');
+ expect(Object.keys(router.push.args[0][0].query)).to.include('testPage');
});
it('should go to the next page', function() {
wrapper.find('#next').simulate('click');
- expect(spy.args[0][0].query.testPage).to.equal(6);
+ expect(router.push.args[0][0].query.testPage).to.equal(6);
});
it('should go to the last page', function() {
wrapper.find('#last').simulate('click');
- expect(spy.args[0][0].query.testPage).to.equal(10);
+ expect(router.push.args[0][0].query.testPage).to.equal(10);
});
it('should go to the previous page', function() {
wrapper.find('#previous').simulate('click');
- expect(spy.args[0][0].query.testPage).to.equal(4);
+ expect(router.push.args[0][0].query.testPage).to.equal(4);
});
it('should go to the first page', function() {
wrapper.find('#first').simulate('click');
- expect(spy.args[0][0].query.testPage).to.equal(1);
+ expect(router.push.args[0][0].query.testPage).to.equal(1);
});
it('should go to a page selected', function() {
wrapper.find('select').simulate('change', { target: { value: 3 }});
- expect(spy.args[0][0].query.testPage).to.equal(3);
+ expect(router.push.args[0][0].query.testPage).to.equal(3);
});
});
describe('with onPageChange prop provided', function() {
let wrapper;
- const onPageChange = sinon.spy();
+ let onPageChange
beforeEach(function() {
+ onPageChange = sinon.spy();
wrapper = mount();
});
- afterEach(function() {
- onPageChange.reset();
- });
-
it('should go to the next page', function() {
wrapper.find('#next').simulate('click');
expect(onPageChange.withArgs(6).calledOnce).to.equal(true);