Skip to content

Commit

Permalink
remove max-len from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Dec 27, 2022
1 parent f93dc21 commit 7054753
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 24 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)}'`,
'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)}'`,
'console.logged warning ok',
);
clearTimeout(testTimeout);
Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/nowebrtc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ if (!isSupported) {
if (input.indexOf('trace') > -1) {
return;
}
// eslint-disable-next-line max-len

const EXPECTED_LOG_STR = `${name}: Document tried to create an RTCPeerConnection: ${TEST_URL_VALUE};`;
assert.ok(endsWith(input, EXPECTED_LOG_STR), 'console.hit input');
};
Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/prevent-eval-if.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test('AG prevent-eval-if works', (assert) => {
const firstActual = evalWrapper(`(function () {return '${agPreventEvalIf}'})()`);
assert.strictEqual(window.hit, undefined, 'hit function should not fire for not matched function');
assert.strictEqual(firstActual, agPreventEvalIf, 'result of eval evaluation should exist');
// eslint-disable-next-line max-len

const secondActual = evalWrapper(`(function () {const test = 0; return '${agPreventEvalIf}'})()`);
assert.strictEqual(window.hit, 'FIRED', 'hit function should fire');
assert.strictEqual(secondActual, undefined, 'result of eval evaluation should be undefined');
Expand Down
1 change: 0 additions & 1 deletion tests/scriptlets/prevent-fetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ if (!isSupported) {
if (input.indexOf('trace') > -1) {
return;
}
// eslint-disable-next-line max-len
const EXPECTED_LOG_STR_START = `${name}: fetch( url:"${INPUT_JSON_PATH}" method:"${TEST_METHOD}"`;
assert.ok(startsWith(input, EXPECTED_LOG_STR_START), 'console.hit input');
};
Expand Down
2 changes: 0 additions & 2 deletions tests/scriptlets/prevent-setInterval.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ test('setInterval callback name matching', (assert) => {
// We need to run our assertion after all timeouts
setTimeout(() => {
assert.equal(window.one, 'value', 'Target property not changed');
// eslint-disable-next-line max-len
assert.equal(window.two, 'new value', 'Another property should successfully changed by another timeout');
assert.strictEqual(window.hit, 'FIRED', 'hit fired');
done();
Expand Down Expand Up @@ -113,7 +112,6 @@ test('code matching', (assert) => {
// We need to run our assertion after all timeouts
setTimeout(() => {
assert.equal(window.one, 'value', 'Target property not changed');
// eslint-disable-next-line max-len
assert.equal(window.two, 'new value', 'Another property should be successfully changed by another timeout');
assert.strictEqual(window.hit, 'FIRED', 'hit fired');
done();
Expand Down
2 changes: 0 additions & 2 deletions tests/scriptlets/prevent-setTimeout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ test('setTimeout callback name matching', (assert) => {
// We need to run our assertion after all timeouts
nativeSetTimeout(() => {
assert.equal(window.one, 'value', 'Target property not changed');
// eslint-disable-next-line max-len
assert.equal(window.two, 'new value', 'Another property should successfully changed by another timeout');
assert.strictEqual(window.hit, 'FIRED', 'hit fired');
done();
Expand Down Expand Up @@ -113,7 +112,6 @@ test('code matching', (assert) => {
// We need to run our assertion after all timeouts
nativeSetTimeout(() => {
assert.equal(window.one, 'value', 'Target property not changed');
// eslint-disable-next-line max-len
assert.equal(window.two, 'new value', 'Another property should be successfully changed by another timeout');
assert.strictEqual(window.hit, 'FIRED', 'hit fired');
done();
Expand Down
1 change: 0 additions & 1 deletion tests/scriptlets/prevent-window-open.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ test('new syntax: log checking - url + args', (assert) => {
if (input.indexOf('trace') > -1) {
return;
}
// eslint-disable-next-line max-len
const EXPECTED_LOG_STR = `${name}: ${testUrl}, ${testWindowName}, ${testWindowFeatures}`;
assert.strictEqual(input, EXPECTED_LOG_STR, 'console.hit input');
};
Expand Down
37 changes: 24 additions & 13 deletions tests/scriptlets/prevent-xhr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ if (isSupported) {
xhr.open(METHOD, URL);
xhr.onload = () => {
assert.strictEqual(typeof xhr.responseText, 'string', 'Response text mocked');
// eslint-disable-next-line max-len
assert.ok(xhr.responseText.length > 20000, `Response text randomized, response length: ${xhr.responseText.length}`);
assert.ok(
xhr.responseText.length > 20000,
`Response text randomized, response length: ${xhr.responseText.length}`,
);
assert.strictEqual(window.hit, 'FIRED', 'hit function fired');
done();
};
Expand All @@ -151,8 +153,10 @@ if (isSupported) {
xhr.onload = () => {
assert.strictEqual(xhr.readyState, 4, 'Response done');
assert.strictEqual(typeof xhr.responseText, 'string', 'Response text mocked');
// eslint-disable-next-line max-len
assert.ok(xhr.responseText.length > 20000, `Response text randomized, response length: ${xhr.responseText.length}`);
assert.ok(
xhr.responseText.length > 20000,
`Response text randomized, response length: ${xhr.responseText.length}`,
);
assert.strictEqual(window.hit, 'FIRED', 'hit function fired');
done();
};
Expand All @@ -173,8 +177,10 @@ if (isSupported) {
xhr.onload = () => {
assert.strictEqual(xhr.readyState, 4, 'Response done');
assert.strictEqual(typeof xhr.responseText, 'string', 'Response text mocked');
// eslint-disable-next-line max-len
assert.ok(xhr.responseText.length === 100, `Response text randomized, response length: ${xhr.responseText.length}`);
assert.ok(
xhr.responseText.length === 100,
`Response text randomized, response length: ${xhr.responseText.length}`,
);
assert.strictEqual(window.hit, 'FIRED', 'hit function fired');
done();
};
Expand All @@ -195,8 +201,10 @@ if (isSupported) {
xhr.onload = () => {
assert.strictEqual(xhr.readyState, 4, 'Response done');
assert.strictEqual(typeof xhr.responseText, 'string', 'Response text mocked');
// eslint-disable-next-line max-len
assert.ok(xhr.responseText.length === 500000, `Response text randomized, response length: ${xhr.responseText.length}`);
assert.ok(
xhr.responseText.length === 500000,
`Response text randomized, response length: ${xhr.responseText.length}`,
);
assert.strictEqual(window.hit, 'FIRED', 'hit function fired');
done();
};
Expand All @@ -216,7 +224,6 @@ if (isSupported) {
xhr.open(METHOD, URL);
xhr.onload = () => {
assert.strictEqual(typeof xhr.responseText, 'string', 'Response text mocked');
// eslint-disable-next-line max-len
assert.ok(xhr.responseText.length === 0, 'Response text is not randomized');
assert.strictEqual(window.hit, 'FIRED', 'hit function fired');
done();
Expand Down Expand Up @@ -257,8 +264,10 @@ if (isSupported) {
xhr.open(METHOD, URL);
xhr.onload = () => {
assert.strictEqual(typeof xhr.responseText, 'string', 'Response text mocked');
// eslint-disable-next-line max-len
assert.ok(xhr.responseText.length >= 100 && xhr.responseText.length <= 300, `Response text randomized, response length: ${xhr.responseText.length}`);
assert.ok(
xhr.responseText.length >= 100 && xhr.responseText.length <= 300,
`Response text randomized, response length: ${xhr.responseText.length}`,
);
assert.strictEqual(window.hit, 'FIRED', 'hit function fired');
done();
};
Expand All @@ -278,8 +287,10 @@ if (isSupported) {
xhr.open(METHOD, URL);
xhr.onload = () => {
assert.strictEqual(typeof xhr.responseText, 'string', 'Response text mocked');
// eslint-disable-next-line max-len
assert.ok(xhr.responseText.length >= 10 && xhr.responseText.length <= 20, `Response text randomized, response length: ${xhr.responseText.length}`);
assert.ok(
xhr.responseText.length >= 10 && xhr.responseText.length <= 20,
`Response text randomized, response length: ${xhr.responseText.length}`,
);
assert.strictEqual(window.hit, 'FIRED', 'hit function fired');
done();
};
Expand Down
1 change: 0 additions & 1 deletion tests/scriptlets/trusted-replace-fetch-response.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ if (!isSupported) {
if (input.indexOf('trace') > -1) {
return;
}
// eslint-disable-next-line max-len
const EXPECTED_LOG_STR_START = `${name}: fetch( url:"${INPUT_JSON_PATH}" method:"${TEST_METHOD}"`;
assert.ok(startsWith(input, EXPECTED_LOG_STR_START), 'console.hit input');
};
Expand Down

0 comments on commit 7054753

Please sign in to comment.