Repository navigation
Fix broken specs so ng test builds and passes - #160
Merged
Merged
Conversation
landing-page spec referenced FormsModule and InputTextareaModule without importing them, which broke compilation of the whole test bundle. The remaining specs failed at injection: add HttpClientTestingModule, the generated ApiModule config, EnvironmentService, a disabled Matomo tracker, and a stub hCaptcha service where needed, plus NO_ERRORS_SCHEMA for component templates that use modules the specs don't import.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ng testonmaindoesn't build.landing-page.component.spec.tsusesFormsModuleandInputTextareaModulebut doesn't import them, so the whole test bundle fails to compile. If that file is fixed, 5 of the 6 tests still fail because their dependencies aren't provided.Change
Only spec files change. No app code is touched.
HttpClientTestingModule, so no real HTTP requests are madeApiModule.forRoot(() => new Configuration())EnvironmentServiceNgxMatomoTrackerModule.forRoot({ disabled: true, ... }). In ngx-matomo 4.0.1,disabledswitches toNoopMatomoTrackerandNoopMatomoInitializer, so the tests load no script and send no tracking.NgHcaptchaServicewith an empty stub. The component only calls it on submit, soshould createnever uses it.ngModel(SelectButton, RadioButton, Checkbox). Without them the test fails with NG01203, no value accessor.NO_ERRORS_SCHEMAso the specs don't have to import every PrimeNG and router module their templates use.The existing tests are only
should create/should be createdchecks. This PR gets them running and passing; it doesn't add coverage.Testing
npx ng test --watch=false --browsers=ChromeHeadless: 6 of 6 pass, with no errors or warnings in the output. Onmainit fails to compile.Conflicts with #159
#159 also edits the imports at the top of
results.component.spec.ts. A test merge of the two branches conflicts in that file. Whichever PR merges second will need a small rebase that keeps both sets of imports.