-
Notifications
You must be signed in to change notification settings - Fork 40
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
Request for mocks for unit-tests #22
Comments
Hey 👋 You mean like for testing with jest? I believe you can already just use mocks from universal, as well as tokens from it. Please let me know if that works for you. |
For Jasmine/Karma. But will check with the mocks from universal. But the mocks and tokens can be taken from universal, why maintain 2 repos with the same functionalities? |
This library is just a library of token so you make your apps without any direct access to global entities, because they might not be available in some environments. Universal package is the package of substitutes for those tokens for server side which also might work in other environments where they are missing. For example jest testing is a lot like universal as it is also emulated DOM. Is Jasmine/Karma you don't need mocks, because tokens are available as is. But you can easily mock them with spies etc. in unit tests. |
@waterplea Do you have an example of how these tokens can be mocked in Jasmine/Karma unit tests? |
When you configure {
provide: WINDOW,
useValue: {
matchMedia(query: string): boolean {
return query === '(min-width: 400px)';
}
}
} for example, if your code depends on screen size by running |
🚀 Feature request
Could we get mocks like how you've provided it in your universal package? Ref - link
import '@ng-web-apis/universal/mocks';
The text was updated successfully, but these errors were encountered: