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

did it support not.toBeObservable? #11

Closed
yutsengwei opened this issue Jan 1, 2018 · 4 comments
Closed

did it support not.toBeObservable? #11

yutsengwei opened this issue Jan 1, 2018 · 4 comments

Comments

@yutsengwei
Copy link

Hi guys,
as title, I am trying to write a test with marbles and Jasmine in Angular.

I have a effect with a filter,
for example:
loadDatas$: Observable = this.actions$.ofType(LOAD_DATAS_ACTION).pipe(
withLatestFrom(this.store.select(getDatas), (action, datas) =>datas),
filter(data => !data.length),
switchMap(() => {
return this.dataApi.find().pipe(
.....

basically, it won't do switch map if the data length > 0.

I wanna test data length > 0,
so I try expect(effects.loadTrials$).not.toBeObservable(expected);
but not what I expect...

did I try something wrong?

@krzysztof-grzybek
Copy link
Contributor

Hi @yutsengwei
Better late than never xD I just encountered this issue. It's a bug because under the hood it uses regular expect. If it would use standard jasmine customer matcher API (returning { pass: boolean, message: string}, it would work.

@skyleguy
Copy link

skyleguy commented Jun 5, 2020

I am doing something similar.

any ideas as to what we can expect instead of doing .not.toBeObservable(ourObservable) ?

it looks like what it is receiving is "Array []" but no matter what i change the expected value to it is not matching exactly

@skyleguy
Copy link

skyleguy commented Jun 5, 2020

actually just got the answer by accident:

const expected = cold('')
expect(effects.myEffect$).toBeObservable(expected)

brandonroberts pushed a commit that referenced this issue Jul 18, 2020
- Prints marble comparison and detailed JSON.stringified test messages below
- If notification is found in the expected TestObservable, then it will match marble character to this Notification, if not, the character will be equal to ?
- fixes not.toBeObservable.

Closes #51, #11
@brandonroberts
Copy link
Member

Fixed via #55

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

4 participants