docs: clear mock after each test and refine expectation for tax calculator call by phhien203 · Pull Request #69524 · angular/angular · GitHub
Skip to content

docs: clear mock after each test and refine expectation for tax calculator call#69524

Open
phhien203 wants to merge 1 commit into
angular:mainfrom
phhien203:phhien203-fix-testing-service-guide
Open

docs: clear mock after each test and refine expectation for tax calculator call#69524
phhien203 wants to merge 1 commit into
angular:mainfrom
phhien203:phhien203-fix-testing-service-guide

Conversation

@phhien203

@phhien203 phhien203 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

…lator call

- We need to clear the mock between different assertions
- We have either toHaveBeenCalledOnce or toHaveBeenCalledExactlyOnceWith matcher
@pullapprove pullapprove Bot requested a review from kirjs June 25, 2026 18:03
@angular-robot angular-robot Bot added the area: docs Related to the documentation label Jun 25, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have either toHaveBeenCalledOnce or toHaveBeenCalledExactlyOnceWith matcher, not toHaveBeenCalledExactlyOnce

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to clear the mock between assertions; otherwise, this error may occur (unless clearMocks is set to true in Vitest config).

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs Related to the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant