Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite using unexpected-mitm mocker #7

Merged
merged 12 commits into from
Apr 28, 2018
Merged

Rewrite using unexpected-mitm mocker #7

merged 12 commits into from
Apr 28, 2018

Conversation

alexjeffburke
Copy link
Collaborator

No description provided.

Make the promise factory mode run via the mocker.
Include a suffix in the test file name allowing the output to be run
by jest on the command line. Also add the runner to the name.
When encountering an early exit situation the mocker will resolve.
This would previously cause the assertion to immediately kick in
While the it() block may not yet have completed at. Defer executing
the assertion until both mocker & afterEach promises are complete.
@coveralls
Copy link

Coverage Status

Coverage decreased (-26.3%) to 72.727% when pulling 98f459c on alexjeffburke:wip/rewriteUsingMocker into 31aae5c on papandreou:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-26.3%) to 72.727% when pulling 98f459c on alexjeffburke:wip/rewriteUsingMocker into 31aae5c on papandreou:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-26.3%) to 72.727% when pulling 98f459c on alexjeffburke:wip/rewriteUsingMocker into 31aae5c on papandreou:master.

@coveralls
Copy link

coveralls commented Apr 4, 2018

Coverage Status

Coverage decreased (-3.0%) to 96.0% when pulling 5e32603 on alexjeffburke:wip/rewriteUsingMocker into 31aae5c on papandreou:master.

Copy link
Owner

@papandreou papandreou left a comment

Choose a reason for hiding this comment

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

This is pure win! 🚢

resolvePromise,
mockerPromise
]).then((result) => {
return expect(function afterEach() {}, 'to perform HTTP traffic', mocker.descriptions);
Copy link
Owner

Choose a reason for hiding this comment

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

This looks a bit weird with the empty function? It suggests that the assertion should be shuffled around a bit so it can be something like expect(mocker, 'to have performed the HTTP traffic that it was supposed to')? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahhh yeah - the reason it looks this way is actually to trick Unexpected into inspecting it (so you get a hint it was in afterEach) but then to output the same assertion as in the promise factory case - having httpception output two different assertions felt like an output inconsistency.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only other way I could think of doing it was to get really deep into overriding the error message and I wanted to avoid that as part of this cleanup..

Copy link
Owner

Choose a reason for hiding this comment

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

Fair :)

@alexjeffburke alexjeffburke changed the title WIP: rewrite using mocker Rewrite using unexpected-mitm mocker Apr 27, 2018
@alexjeffburke alexjeffburke merged commit d066e88 into papandreou:master Apr 28, 2018
@alexjeffburke alexjeffburke deleted the wip/rewriteUsingMocker branch April 28, 2018 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants