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

ngx-bootstrap/datepicker jest tests fails silently #6545

Open
Luke265 opened this issue Jan 23, 2023 · 0 comments · May be fixed by #6628
Open

ngx-bootstrap/datepicker jest tests fails silently #6545

Luke265 opened this issue Jan 23, 2023 · 0 comments · May be fixed by #6628

Comments

@Luke265
Copy link

Luke265 commented Jan 23, 2023

Description:
So, I've just cloned this repo, ran tests for datepicker component, all tests passed. But I think there is a problem with subscriptions in those tests, e.g:

datepickerContainerInstance[`_store`]
.select(state => state)
.subscribe(view => {
expect(view.maxDate).toEqual(correctDateEnd);
});

But RxJS throws error asynchorinously since version 6 https://v6.rxjs.dev/guide/v6/migration#typescript-prototype-operators . You can even add throw new Error('Should fail') to the subscription callback, and the test will pass. So some of these tests fail silently. In this case, this code block should look some thing like this:

    let view = await firstValueFrom(datepickerContainerInstance[`_store`].select((state) => state));
    expect(view.maxDate).toEqual(correctDateEnd);
@SvetlanaMuravlova SvetlanaMuravlova self-assigned this Jan 24, 2023
hansireit added a commit to hansireit/ngx-bootstrap that referenced this issue Dec 21, 2023
hansireit added a commit to hansireit/ngx-bootstrap that referenced this issue Dec 21, 2023
Unit-tests that cannot fail are useless, therefore I implemented this fix
* unit test fail if the expected value does not match
* remove duplicated unit test

Closes valor-software#6545
hansireit added a commit to hansireit/ngx-bootstrap that referenced this issue Dec 21, 2023
Unit-tests that cannot fail are useless, therefore this fix
* unit test now fail if the expected value does not match
* remove duplicated unit test

Closes valor-software#6545
@hansireit hansireit linked a pull request Dec 21, 2023 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants