feat: achieve 100% unit test coverage with performance regression guards#7
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
feat: achieve 100% unit test coverage with performance regression guards#7devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
…, interceptors, pipes, and directives - Track 1: Core auth component & if-authenticated directive specs - Track 2: API, error, and token interceptor specs - Track 3: Footer and header layout component specs - Track 4: Expanded articles, comments, and tags service specs - Track 5: Article, editor, and home page component specs - Track 6: Article comment, list, meta, preview, and favorite button specs - Track 7: Follow button, profile articles/favorites, and profile page specs - Track 8: Settings component, app component, app config, and app routes specs - Track 9: List errors component, default-image and markdown pipe specs - Track 10: Coverage thresholds (100% lines/functions/branches/statements) and test:coverage:ci script - Added profile.routes.spec.ts for lazy-loaded route coverage - Expanded user.service.spec.ts with error handling, retry logic, and sync method tests - Added @vitest/coverage-v8 and zone.js dev dependencies 33 test files, 447 tests, 100% coverage on all metrics Co-Authored-By: Phil Bedford <phil.g.bed@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Adds comprehensive unit tests across all components, services, interceptors, pipes, and directives — going from ~6 service-only spec files to 33 spec files with 447 tests achieving 100% line/branch/function/statement coverage.
New spec files (27): auth component, if-authenticated directive, 3 interceptors, footer/header layout, 5 article shared components, 3 article page components, 4 profile components/pages, profile routes, settings component, app component/config/routes, list-errors component, 2 pipes.
Expanded:
user.service.spec.tswith error handling (4XX/5XX), exponential backoff retry logic,getCurrentUserSync(), and auth state observable tests.Config changes:
vitest.config.ts: Added 100% coverage thresholds for lines/functions/branches/statementspackage.json: Addedtest:coverage:ciscript (vitest run --coverage)@vitest/coverage-v8andzone.jsas dev dependenciesReview & Testing Checklist for Human
@angular/coreversion drift inbun.lock: The lockfile resolved@angular/coreto 21.2.4 whilepackage.jsonpins other@angular/*packages at 21.1.1. Verify this mismatch doesn't cause peer dependency issues or subtle runtime differences. Consider whether this bump was intentional or a side effect ofbun install..htmland.csstemplate files (which show 0% in the report) are properly excluded from threshold enforcement, and that adding new source files won't break CI until tests are added.as anyfor service mocks rather than typed mocks. Spot-check a few specs (e.g.,article.component.spec.ts,profile.component.spec.ts) to verify the mocks reflect actual service interfaces and that tests exercise real component logic rather than just the mocks.provideAppInitializerintegration test: The test inapp.config.spec.tsbootstraps TestBed with the fullappConfig.providersto cover lines 74-77. Verify this test isn't flaky — it relies onApplicationInitStatus.donePromiseresolving and the realJwtService/UserServiceinitializing in jsdom.Recommended test plan: Run
bun run test:coverage:cilocally and confirm the coverage report shows 100% across all.tsfiles with exit code 0. Then try adding a new untested function to any source file and verify the threshold enforcement fails the run.Notes
zone.jsimports,TestBedwithbeforeAll+initTestEnvironmentpattern required by thepool: 'threads'config.beforeAll/initTestEnvironmentpattern means each spec file must initialize TestBed exactly once. Files with multipledescribeblocks only call it in the first block.Link to Devin session: https://app.devin.ai/sessions/8727d068b98941bfa16cb82f11b76ee3
Requested by: @dr-phil