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

Refactor test utilities #172

Closed
kettanaito opened this issue Nov 6, 2021 · 3 comments · Fixed by #213
Closed

Refactor test utilities #172

kettanaito opened this issue Nov 6, 2021 · 3 comments · Fixed by #213
Labels

Comments

@kettanaito
Copy link
Member

kettanaito commented Nov 6, 2021

There are several points about our test utilities (test/helpers.ts) that I find unpleasant:

  1. Introduce too much logic and, respectively, boilerplate to be used.
  2. The concept of pool and automatic lookup is terrible. Use jest.fn() instead!
  3. All written in a single, large file, making them hard to read.

Expected behavior

  1. Get rid of utilities that are written only for the sake of promisifying callback-based request modules (i.e. http/XMLHttpRequest). Embrace those modules directly, this will improve their reliability and increase their referencing factor.
  2. Structure the remaining utilities under their respective surface: test/helpers/http.ts, test/helpers/XMLHttpRequest.ts, etc.).
  3. Adjust the affected tests.
@kettanaito
Copy link
Member Author

events-order test can also be improved. We can utilize Jest's .toHaveBeenNthCalledWith to assert both the event listener's call order and arguments.

@kettanaito
Copy link
Member Author

Removed the entire test/utils directory that contained what appears the initial implementation of test-server.

@github-actions
Copy link

🎉 This issue has been resolved in version 0.13.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

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 a pull request may close this issue.

1 participant