Skip to content

refactor: Rewrite test with mock timer using got/async#1785

Merged
paulmelnikow merged 4 commits intomasterfrom
reply-headers-got
Oct 29, 2019
Merged

refactor: Rewrite test with mock timer using got/async#1785
paulmelnikow merged 4 commits intomasterfrom
reply-headers-got

Conversation

@paulmelnikow
Copy link
Copy Markdown
Member

No description provided.

done()
})
const req = got('http://example.test/')
clock.tick()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

clock.tick() was the key to making this work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's unclear to me at a glance if creating the date var before the clock.tick() is important.
If it's not, could we move it down to just above the assertion that uses it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It would be better if it were after the clock.tick() and I've moved it. I'm surprised that it can be just before the assertion and still work, though it seems to! Happy to keep it there. I don't feel like this mock timers business is something I need to fully grasp.

@paulmelnikow paulmelnikow mentioned this pull request Oct 29, 2019
@paulmelnikow paulmelnikow merged commit 6aa42aa into master Oct 29, 2019
@paulmelnikow paulmelnikow deleted the reply-headers-got branch October 29, 2019 23:20
@nockbot
Copy link
Copy Markdown
Collaborator

nockbot commented Oct 31, 2019

🎉 This PR is included in version 11.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

juninmd pushed a commit to juninmd/nock that referenced this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants