Skip to content

Add unit tests for components, routes, and app config#16

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1777411729-add-unit-tests
Open

Add unit tests for components, routes, and app config#16
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1777411729-add-unit-tests

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 28, 2026

Summary

Adds 8 new Vitest unit test files covering the previously identified coverage gaps: components, route definitions, app config/initializer, and profile routes. Also adds zone.js as a dev dependency for the test infrastructure.

New test files (101 new tests):

  • app.config.spec.ts — Tests initAuth() factory and window.__conduit_debug__ debug interface
  • app.routes.spec.ts — Tests route definitions, guard configuration, and route count
  • header.component.spec.ts — Tests auth-state-based navigation (loading, unauthenticated, authenticated, unavailable)
  • auth.component.spec.ts — Tests login/register form, auth service integration, error handling, and navigation
  • home.component.spec.ts — Tests feed toggling, tag filtering, page navigation, and auth redirect
  • article.component.spec.ts — Tests article/comments loading, CRUD operations, favorite/follow toggling
  • editor.component.spec.ts — Tests create/edit article modes, tag management, authorization redirect
  • profile.routes.spec.ts — Smoke tests for profile child routes structure

Other changes:

  • Added zone.js@0.16.1 as a dev dependency (required by Angular TestBed infrastructure)
  • Updated test-setup.ts with improved error handling in try/catch

All 281 tests pass locally (14 test files, 180 existing + 101 new).

Review & Testing Checklist for Human

  • Run bun run test to verify all 281 tests pass
  • Spot-check that new test files follow the existing TestBed + vi.fn() pattern
  • Verify no source code was modified (only test files, package.json, bun.lock, test-setup.ts)

Notes

  • Uses provideRouter([]) instead of deprecated RouterTestingModule for Angular 21 compatibility
  • Component tests use mock child components via overrideComponent to isolate the unit under test
  • The IfAuthenticatedDirective requires isAuthenticated observable on UserService mocks

Link to Devin session: https://app.devin.ai/sessions/da36386cf4eb4b16b729e7e2656f6a79
Requested by: @WesternConcrete


Open in Devin Review

- app.config.spec.ts: Tests for initAuth() and window.__conduit_debug__
- app.routes.spec.ts: Tests for route definitions and guard configuration
- header.component.spec.ts: Tests for auth-state-based navigation
- auth.component.spec.ts: Tests for login/register form and auth service
- home.component.spec.ts: Tests for feed toggling and tag filtering
- article.component.spec.ts: Tests for article/comments load and CRUD
- editor.component.spec.ts: Tests for create/edit article and tag management
- profile.routes.spec.ts: Smoke tests for profile child routes
- Add zone.js as dev dependency for test infrastructure
- Update test-setup.ts with improved error handling

Co-Authored-By: Wes Convery <2wconvery@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@staging-devin-ai-integration
Copy link
Copy Markdown

Devin Review

Status Commit
⚪ Not started

Open in Devin Review (Staging)

💡 Connect your GitHub account to enable automatic code reviews.

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread package.json
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 @angular/core version mismatch with all other Angular packages causes peer dependency violations

@angular/core is bumped to 21.2.4 while every other @angular/* package remains at 21.1.1. The lockfile confirms exact peer dependency requirements: @angular/common@21.1.1, @angular/forms@21.1.1, @angular/animations@21.1.1, @angular/platform-browser@21.1.1, @angular/platform-browser-dynamic@21.1.1, and @angular/router@21.1.1 all require exactly @angular/core: "21.1.1". Additionally, @angular/core@21.2.4 has a peer dependency on @angular/compiler: "21.2.4" but only @angular/compiler@21.1.1 is installed. Angular requires all @angular/* packages to be at the same version; mixing versions can cause cryptic runtime errors (DI failures, change detection issues, template compilation problems).

(Refers to line 32)

Prompt for agents
The @angular/core package was bumped to 21.2.4 (likely by Dependabot) without updating the other Angular packages. All @angular/* packages must be kept at the same version. Either revert @angular/core back to 21.1.1 to match the other packages, or update ALL Angular packages (@angular/animations, @angular/common, @angular/compiler, @angular/forms, @angular/platform-browser, @angular/platform-browser-dynamic, @angular/router, @angular/build, @angular/cli, @angular/compiler-cli) to 21.2.4 simultaneously. The relevant files are package.json and bun.lock.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @angular/core@21.2.4 version was already on the branch before this PR's changes (from the user's provided diff). This PR only added zone.js as a devDependency to package.json. The Angular version alignment is outside the scope of this test-only PR.

Comment thread src/app/features/article/pages/home/home.component.spec.ts Outdated
Co-Authored-By: Wes Convery <2wconvery@gmail.com>
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.

1 participant