feature: raise unit test coverage to ~98% with Vitest#31
feature: raise unit test coverage to ~98% with Vitest#31devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Add unit tests for previously untested interceptors, pipes, directive, layout, shared, feature components and pages, plus retry/unavailable coverage for UserService. Configure v8 coverage (all source files) and add a shared TestBed init helper. Overall line coverage: 17.32% -> 99.5%, statements 18.36% -> 98.45%. Co-Authored-By: Bobby Nobakht <bobby.nobakht@cognition.ai>
🤖 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:
|
CI note:
|
Summary
Adds Vitest unit tests for the ~24 previously-untested source files (interceptors, pipes, the auth directive, layout/shared components, all feature components, and the article/editor/home/profile/settings pages), plus retry/unavailable-state coverage for
UserService. No production code was changed.Coverage (before → after)
Measured with the same
vitest.config.ts(all: trueoversrc/**/*.ts, excluding specs, models, routes,app.config.ts,main.ts, test helpers), so the numbers are apples-to-apples.Tests: 180 → 291 (all passing; no existing tests modified or weakened).
What was tested
api(url prefixing),token(auth header),error(401 purge,/userspecial-case, error normalization)default-image,markdownif-authenticated(view create/clear on auth state)app,header,footer,list-errorsfavorite-button,article-meta,article-preview,article-comment,article-list, and thearticle,editor,homepagesfollow-button,profile-articles,profile-favorites, and theprofilepagesettingspageunavailablestate + retry-cancel tests (70.9% → 98.18%)Notes / mechanics
@vitest/coverage-v8andzone.jsdev deps (required for v8 coverage + Angular TestBed in jsdom).src/testing/setup-test-bed.tsinitializes the Angular TestBed once per file (imports@angular/compilerfirst to avoid JIT errors onPlatformLocation). Excluded from coverage.vitest.config.ts: enabledall: trueso untested files count toward overall coverage, addedjson-summaryreporter, and excluded non-executable declaration/config files (models, routes,app.config.ts).TestBedwith mocked services (RxJSof/throwError/BehaviorSubject); HTTP-level service tests keep usingHttpClientTestingModule.bun run format;format:checkis clean. e2e/Playwright tests untouched.Link to Devin session: https://app.devin.ai/sessions/54747daa1bc44e1187c3da73f91a8489
Requested by: @bnob-git
Devin Review