-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up pages/NnsProposalDetail.spec.ts (#5537)
# Motivation Make the test easier to maintain. Also there was a bug in the `"should NOT query neurons"` test. Because the setup was mixing `mutableMockAuthStoreSubscribe` and `mockAuthStoreSubscribe`, the user was actually signed in. But ``` await waitFor(() => expect(governanceApi.queryNeurons).not.toHaveBeenCalled() ); ``` succeeded before the code had a chance to query the neurons. This is why we should never use `waitFor` and always use `runResolvedPromises` instead. # Changes 1. Import the component as its actual name instead of as `ProposalDetail`. 2. Use `resetIdentity()` and `setNoIdentity()` instead of mocking the `authStore`. 3. Don't mock `proposalsStore` or `neuronsStore`. 4. `proposalsApi.queryProposal` instead of mocking the governance canister. 5. Use a page object. 6. Use `runResolvedPromises` instead of `waitFor` Drive-by: Fix type with double `Proposal` in `getProposalProposalSystemInfoSectionPo`. # Tests Test only # Todos - [ ] Add entry to changelog (if necessary). not necessary
- Loading branch information
Showing
3 changed files
with
57 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters