Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Dec 27, 2022
1 parent 0903fb6 commit 21da001
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests/scriptlets/adjust-setInterval.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ test('no match -- invalid callback - undefined', (assert) => {
assert.strictEqual(window.hit, undefined, 'hit should not fire');
assert.strictEqual(
loggedMessage,
`${name}: Scriptlet can't be applied because of invalid callback: '${String(callback)}';`, // eslint-disable-line max-len
`${name}: Scriptlet can't be applied because of invalid callback: '${String(callback)}'`, // eslint-disable-line max-len
'console.logged warning ok',
);
clearInterval(testInterval);
Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/adjust-setTimeout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ test('no match -- invalid callback - undefined', (assert) => {
assert.strictEqual(window.hit, undefined, 'hit should not fire');
assert.strictEqual(
loggedMessage,
`${name}: Scriptlet can't be applied because of invalid callback: '${String(callback)}';`, // eslint-disable-line max-len
`${name}: Scriptlet can't be applied because of invalid callback: '${String(callback)}'`, // eslint-disable-line max-len
'console.logged warning ok',
);
clearTimeout(testTimeout);
Expand Down
4 changes: 2 additions & 2 deletions tests/scriptlets/log-eval.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test('logs eval calls', (assert) => {
if (input.indexOf('trace') > -1) {
return;
}
assert.strictEqual(input, `${name}: eval("${evalStr}");`, 'console.hit input should be equal');
assert.strictEqual(input, `${name}: eval("${evalStr}")`, 'console.hit input should be equal');
};
runScriptlet(name);
const evalWrap = eval;
Expand All @@ -52,7 +52,7 @@ test('logs new Function() calls', (assert) => {
if (input.indexOf('trace') > -1) {
return;
}
assert.strictEqual(input, `${name}: new Function(${args.join(', ')});`, 'console.hit input should be equal');
assert.strictEqual(input, `${name}: new Function(${args.join(', ')})`, 'console.hit input should be equal');
};

runScriptlet(name);
Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/prevent-requestAnimationFrame.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test('prevent-requestAnimationFrame: no args -- logging', (assert) => {
assert.strictEqual(window.hit, 'FIRED', 'hit fired');
assert.strictEqual(
loggedMessage,
`prevent-requestAnimationFrame: requestAnimationFrame(${testFunction.toString()});`,
`prevent-requestAnimationFrame: requestAnimationFrame(${testFunction.toString()})`,
'console.hit input',
);
assert.strictEqual(window[logProperty], 'changed', 'property changed');
Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/prevent-setInterval.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test('no args -- logging', (assert) => {
assert.strictEqual(window.hit, 'FIRED', 'hit fired');
assert.strictEqual(
loggedMessage,
`prevent-setInterval: setInterval(${callback.toString()}, ${timeout});`,
`prevent-setInterval: setInterval(${callback.toString()}, ${timeout})`,
'console.hit input ok',
);
assert.strictEqual(window[agLogSetInterval], 'changed', 'property changed');
Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/prevent-setTimeout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test('no args -- logging', (assert) => {
assert.strictEqual(window.hit, 'FIRED', 'hit fired');
assert.strictEqual(
loggedMessage,
`prevent-setTimeout: setTimeout(${callback.toString()}, ${timeout});`,
`prevent-setTimeout: setTimeout(${callback.toString()}, ${timeout})`,
'console.hit input ok',
);
assert.strictEqual(window[agLogSetTimeout], 'changed', 'property changed');
Expand Down
4 changes: 2 additions & 2 deletions tests/scriptlets/prevent-window-open.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ test('new syntax: log checking - only url', (assert) => {
if (input.indexOf('trace') > -1) {
return;
}
const EXPECTED_LOG_STR = `${name}: ${testUrl};`;
const EXPECTED_LOG_STR = `${name}: ${testUrl}`;
assert.strictEqual(input, EXPECTED_LOG_STR, 'console.hit input');
};

Expand All @@ -208,7 +208,7 @@ test('new syntax: log checking - url + args', (assert) => {
return;
}
// eslint-disable-next-line max-len
const EXPECTED_LOG_STR = `${name}: ${testUrl}, ${testWindowName}, ${testWindowFeatures};`;
const EXPECTED_LOG_STR = `${name}: ${testUrl}, ${testWindowName}, ${testWindowFeatures}`;
assert.strictEqual(input, EXPECTED_LOG_STR, 'console.hit input');
};

Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/remove-attr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ test('invalid selector — no match', (assert) => {
}
assert.strictEqual(
input,
`${name}: Invalid selector arg: '${selector}';`,
`${name}: Invalid selector arg: '${selector}'`,
'logged error for invalid remove-attr selector;',
);
};
Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/remove-class.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ test('invalid selector — no match', (assert) => {
if (input.indexOf('trace') > -1) {
return;
}
assert.strictEqual(input, `${name}: Invalid selector arg: '${selectors}';`, 'logged error for invalid remove-class selector');
assert.strictEqual(input, `${name}: Invalid selector arg: '${selectors}'`, 'logged error for invalid remove-class selector');
};

assert.strictEqual(window.hit, undefined, 'hit SHOULD NOT fire');
Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/trusted-set-cookie.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ test('Set cookie with invalid expires', (assert) => {
}
assert.strictEqual(
input,
`${name}: Invalid offsetExpiresSec value: ${expiresSec};`,
`${name}: Invalid offsetExpiresSec value: ${expiresSec}`,
'logs correctly on invalid offsetExpiresSec',
);
};
Expand Down

0 comments on commit 21da001

Please sign in to comment.