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

Fix test after latest changes and fix flaky test. #770

Merged
merged 13 commits into from
Aug 24, 2024

Conversation

jjsil
Copy link
Collaborator

@jjsil jjsil commented Aug 24, 2024

  • Fix tests added or broken by the latest changes in develop.
  • Create PipesModule to import pipes without having to import SharedModule. Import it in all test modules instead of declaring XPipe classes.
  • Fix test flakiness (random tests would fail in different runs) caused by an error in BrewBrewingGraphComponent.destroy during tests when this.settings was not initialised.

Resolves #730.
Once this is merged, the tests should be in a good enough state to submit the GitHub Action to run tests automatically for #740.

jjsil added 13 commits August 24, 2024 19:44
Split beforeEach into async and sync.
This module allows importing e.g. "keys" pipe in tests without having to import SharedModule.
Use this in all the tests instead of declaring the Pipes in the testing module, which should only declare the component under test.
New use of Device.
New use of ngModel, add FormsModule import.
While here, replace TranslatePipe declaration and use of TranslateServiceMock with TranslateModule imports.
New use of Device.
New use of storage.
While here, replace TranslatePipe declaration and use of TranslateServiceMock with TranslateModule imports.
During the tests, `this.settings` is not set. This was causing a failure in onDestroy and prevent the component from being cleaned up properly. This resulted in random failures in unrelated tests with the error:
```
Uncaught Error: Uncaught (in promise): TypeError: _this5.brewComponent.timer?.isTimerRunning is not a function TypeError: _this5.brewComponent.timer?.isTimerRunning is not a function at http://localhost:9876/_karma_webpack_/webpack:/src/components/brews/brew-brewing-graph/brew-brewing-graph.component.ts:1319:35
```
@jjsil jjsil requested a review from graphefruit August 24, 2024 11:13
@jjsil jjsil self-assigned this Aug 24, 2024
Copy link

@jjsil jjsil linked an issue Aug 24, 2024 that may be closed by this pull request
@graphefruit
Copy link
Owner

Thanks for the PR and all the effort you took into it!
Merged :)

@graphefruit graphefruit merged commit 26b3a9a into graphefruit:develop Aug 24, 2024
2 checks passed
@jjsil jjsil deleted the infra/fix-tests branch August 25, 2024 01:03
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

Successfully merging this pull request may close these issues.

Fix tests
2 participants