add stryker, test for timeout valid signature
This commit is contained in:
parent
314b9ffb19
commit
d47281149f
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,3 +2,6 @@
|
|||||||
/dist/
|
/dist/
|
||||||
/.nyc_output/
|
/.nyc_output/
|
||||||
/coverage/
|
/coverage/
|
||||||
|
|
||||||
|
# stryker temp files
|
||||||
|
.stryker-tmp
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@scode/eslint-config": "^1.2.25",
|
"@scode/eslint-config": "^1.2.25",
|
||||||
|
"@stryker-mutator/core": "^2.5.0",
|
||||||
|
"@stryker-mutator/javascript-mutator": "^2.5.0",
|
||||||
"ava": "^3.5.0",
|
"ava": "^3.5.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"nyc": "^15.0.0"
|
"nyc": "^15.0.0"
|
||||||
|
11
stryker.conf.js
Normal file
11
stryker.conf.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module.exports = function(config) {
|
||||||
|
config.set({
|
||||||
|
mutator: "javascript",
|
||||||
|
packageManager: "yarn",
|
||||||
|
reporters: ["clear-text"],
|
||||||
|
testRunner: "command",
|
||||||
|
transpilers: [],
|
||||||
|
coverageAnalysis: "all",
|
||||||
|
mutate: ["index.js"]
|
||||||
|
});
|
||||||
|
};
|
@ -103,6 +103,16 @@ test ('reject old signatures', async (t) => {
|
|||||||
t.is (dec, null);
|
t.is (dec, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test ('do not reject valid signatures', async (t) => {
|
||||||
|
const obj = { foo: 'bar' };
|
||||||
|
const str = crypto.sign_object (obj, 'baz');
|
||||||
|
await new Promise ((res) => {
|
||||||
|
setTimeout (res, 10);
|
||||||
|
});
|
||||||
|
const dec = crypto.verify_signature (str, 'baz', 100);
|
||||||
|
t.deepEqual (obj, dec);
|
||||||
|
});
|
||||||
|
|
||||||
test ('decode problematic token', (t) => {
|
test ('decode problematic token', (t) => {
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
const str = 'eyJpYXQiOjE1ODE0NDAwMTIyODgsIm9iaiI6eyJpZCI6MX19.24ZOsWrnfkNe%2FbM0r7DaVJMqE2bfn2aAM%2BZSzWeSf31OCTlXXNWD34RBL2X5v3UliYQ4IIsLNBFbaW9texPHug%3D%3D';
|
const str = 'eyJpYXQiOjE1ODE0NDAwMTIyODgsIm9iaiI6eyJpZCI6MX19.24ZOsWrnfkNe%2FbM0r7DaVJMqE2bfn2aAM%2BZSzWeSf31OCTlXXNWD34RBL2X5v3UliYQ4IIsLNBFbaW9texPHug%3D%3D';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user