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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SDK Tests #7469

Merged
merged 6 commits into from Aug 19, 2021
Merged

Fix SDK Tests #7469

merged 6 commits into from Aug 19, 2021

Conversation

rmcfadzean
Copy link
Contributor

Closes #6543

Changed PATCH to POST for invite accept test

This seems like it may have just been an oversight from awhile back. Simple fix.

Replaced jest-environment-jsdom-global with jest-environment-jsdom

This wasn't strictly essential but saves an abstraction/package that isn't really required.

quick polyfill of clearImmediate

clearImmediate isn't part of jest-environment-jsdom (jestjs/jest#11222) anymore so I used the versions from the timers package.

Removed mockdate

This was causing some issues due to the way it overwrites the Date global.

Example: boblauer/MockDate#46

Use jest.useFakeTimers instead

Jest 27 changed the default behaviour for jest.useFakeTimers to the modern implementation which is based on @sinonjs/fake-timers (formerly lolex).

This was causing timeouts with nock not executing responses (see: nock/nock#2200).

The flush function was updated to fix this by calling jest.runAllTicks as well as the promise flush.

Let me know if you need any more info 馃殌

Using `jest-environment-jsdom-global` didn't seem to bring any used advantages over the default `jest-environment-node`
@benhaynes
Copy link
Sponsor Member

Thank you, @rmcfadzean!! 鉂わ笍

@jamescammarano jamescammarano merged commit 8c965ba into directus:main Aug 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2024
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.

Fix SDK tests
4 participants