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

Mocking SharedStorage in tests #85

Open
BojanKogoj opened this issue Mar 9, 2020 · 3 comments
Open

Mocking SharedStorage in tests #85

BojanKogoj opened this issue Mar 9, 2020 · 3 comments
Labels

Comments

@BojanKogoj
Copy link

For some reason tests override each others state when using @SharedStorage().
Is there a way I could mock decorator, so values wouldn't be shared in tests?

To make it even worse this only happens on CI server, which makes it hard to debug.

@DanielKucal
Copy link
Member

Why don't you want the values to be shared in tests, like it'll be in the app? I think you can set initial value in class constructor for the cases you want to override stored value.

@BojanKogoj
Copy link
Author

I have test A that uses shared object X in component. Test B has uses shared object Y in tests, but somehow ends up with X and fails because of this. These two tests use same shared property, but aren't even for the same component.
For testing purpose I'm fine with these shared properties to behave as if they're not shared at all.

@DanielKucal
Copy link
Member

@BojanKogoj, I think you can fire sharedStorageService.clear() before each test to have a fresh state 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants