Skip to content

Commit

Permalink
tweak buggy test
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Dec 22, 2022
1 parent 55c72f6 commit 47b9202
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/scriptlets/prevent-xhr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,7 @@ if (isSupported) {

runScriptlet(name, MATCH_DATA);

const done1 = assert.async();
const done2 = assert.async();
const done = assert.async(2);

const xhr1 = new XMLHttpRequest();
const xhr2 = new XMLHttpRequest();
Expand All @@ -611,15 +610,15 @@ if (isSupported) {
assert.strictEqual(xhr1.readyState, 4, 'Response done');
assert.ok(xhr1.response, 'Response data exists');
assert.strictEqual(window.hit, undefined, 'hit should not fire');
done1();
done();
};

xhr2.onload = () => {
assert.strictEqual(xhr2.readyState, 4, 'Response done');
assert.strictEqual(typeof xhr2.responseText, 'string', 'Response text mocked');
assert.strictEqual(window.hit, 'FIRED', 'hit function fired');
clearGlobalProps('hit');
done2();
done();
};

xhr1.send();
Expand Down

0 comments on commit 47b9202

Please sign in to comment.