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

Incorrect Subject test #542

Open
DKozachenko opened this issue Jul 28, 2024 · 1 comment
Open

Incorrect Subject test #542

DKozachenko opened this issue Jul 28, 2024 · 1 comment

Comments

@DKozachenko
Copy link

Hello!
I tried to test some subjects in my project and encountered on problem (or feature?). I created a separated spec file for showing you my misunderstanding.

subject

Test B works, because it's copied from docs. Test A (without scheduling using "schedule" function) doesn't work and tells me, that there is no emitted value. For me it's strange, because I call "next" method.

Mb I don't understand smth and it's a feature?

I will be glad any comments or description why it works like this

@DKozachenko DKozachenko changed the title Incorrect subject test Incorrect Subject test Jul 28, 2024
@just-jeb
Copy link
Owner

It's very simple - for tests we use a special scheduler that "fakes" the time and the frames.
When you use one of the initialization methods provided by this library (like cold or hot) or when you use schedule method, the Subject is evaluated by this scheduler, hence integrated in the testing environment.
When you just use .next then the internal test scheduler is not aware of this information, so the test fails.

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

No branches or pull requests

2 participants