Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Update Sucuri WAF Solving #242

Merged
merged 1 commit into from Aug 12, 2019
Merged

Update Sucuri WAF Solving #242

merged 1 commit into from Aug 12, 2019

Conversation

ghost
Copy link

@ghost ghost commented Aug 11, 2019

See #240

@ghost ghost mentioned this pull request Aug 11, 2019
@ghost ghost requested a review from codemanki August 11, 2019 18:13
@ghost
Copy link
Author

ghost commented Aug 11, 2019

If merging this, please merge #243 first, I'll fix the conflicts here.

Copy link
Owner

@codemanki codemanki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks excellent to me!

@codemanki
Copy link
Owner

Thank you :)

@codemanki codemanki merged commit c768d05 into codemanki:master Aug 12, 2019
@ghost
Copy link
Author

ghost commented Aug 12, 2019

Yw and Thank you @codemanki,

🤔 I thought there would be a conflict.

This PR is missing the fix from #243. One test like this isn't a big deal whereas before almost all of them had this problem. So we can ignore this for now if desired.

The problem is with the promise resolving and calling done even if the test errors. The solution was to move the following code into the callback so any errors would prevent done being called. Otherwise, the test can both pass and fail.

expect(promise).to.eventually.equal(requestedPage).and.notify(done);

Buggy:

const promise = cloudscraper.get(options, function (error, response, body) {
expect(error).to.be.null;
expect(Request).to.be.calledTwice;
expect(Request.firstCall).to.be.calledWithExactly(helper.defaultParams);
expect(Request.secondCall).to.be.calledWithExactly(expectedParams);
expect(body).to.be.equal(requestedPage);
});
expect(promise).to.eventually.equal(requestedPage).and.notify(done);
});

Fixed:

const promise = cloudscraper.get(options, function (error, response, body) {
expect(error).to.be.null;
expect(Request).to.be.calledTwice;
expect(Request.firstCall).to.be.calledWithExactly(helper.defaultParams);
expect(Request.secondCall).to.be.calledWithExactly(expectedParams);
expect(body).to.be.equal(requestedPage);
expect(promise).to.eventually.equal(requestedPage).and.notify(done);
});
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant