Skip to content

Comments

Refactor test code for improved readability and organization#32

Merged
aalmada merged 3 commits intomainfrom
fix/refactor_test_helpers
Feb 15, 2026
Merged

Refactor test code for improved readability and organization#32
aalmada merged 3 commits intomainfrom
fix/refactor_test_helpers

Conversation

@aalmada
Copy link
Owner

@aalmada aalmada commented Feb 15, 2026

Refactor test code to utilize new helper methods, enhancing readability and maintainability. Standardize using directives across test files for better organization.

…nd maintainability

- Updated `UnverifiedAccountCleanupTests` to include `BookStore.AppHost.Tests.Helpers`.
- Refactored `UpdateTests` to replace `TestHelpers` with `HttpClientHelpers`, `FakeDataGenerators`, and specific entity helpers for authors, categories, publishers, and books.
- Modified `WebTests` to include `BookStore.AppHost.Tests.Helpers`.
Copilot AI review requested due to automatic review settings February 15, 2026 21:37
@aalmada aalmada enabled auto-merge (rebase) February 15, 2026 21:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors test code by breaking down a monolithic TestHelpers.cs file (1649 lines) into smaller, focused helper classes organized in a Helpers namespace. The refactoring improves code organization, readability, and maintainability by grouping related functionality together. All test files have been updated to use the new helper methods with standardized using directives.

Changes:

  • Deleted monolithic TestHelpers.cs and split functionality into 10 specialized helper classes
  • Created organized helper classes: AuthenticationHelpers, AuthorHelpers, BookHelpers, CategoryHelpers, DatabaseHelpers, FakeDataGenerators, HttpClientHelpers, PublisherHelpers, ShoppingCartHelpers, and SseEventHelpers
  • Updated 50+ test files to use new helper methods with consistent naming patterns
  • Added standardized using BookStore.AppHost.Tests.Helpers; directive across all test files
  • Minor formatting improvements to AGENTS.md

Reviewed changes

Copilot reviewed 63 out of 63 changed files in this pull request and generated no comments.

Show a summary per file
File Description
TestHelpers.cs Deleted 1649-line monolithic helper file
Helpers/AuthenticationHelpers.cs New: User authentication, login, and registration helpers
Helpers/AuthorHelpers.cs New: Author CRUD operation helpers
Helpers/BookHelpers.cs New: Book CRUD, rating, and favorites helpers
Helpers/CategoryHelpers.cs New: Category CRUD operation helpers
Helpers/DatabaseHelpers.cs New: Database access and tenant seeding helpers
Helpers/FakeDataGenerators.cs New: Test data generation using Bogus
Helpers/HttpClientHelpers.cs New: HTTP client creation and configuration helpers
Helpers/PublisherHelpers.cs New: Publisher CRUD operation helpers
Helpers/ShoppingCartHelpers.cs New: Shopping cart operation helpers
Helpers/SseEventHelpers.cs New: SSE event listening and waiting helpers
50+ test files Updated to use new helper methods with standardized imports
PasskeyTestHelpers.cs Updated to use DatabaseHelpers
AGENTS.md Minor formatting improvements with blank lines

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Health
JasperFx 0% 0%
BookStore.ApiService 11% 13%
BookStore.Shared 16% 10%
BookStore.Shared 17% 38%
Summary 11% (1368 / 22305) 22% (590 / 10003)

@aalmada aalmada merged commit 7ecc77a into main Feb 15, 2026
10 checks passed
@aalmada aalmada deleted the fix/refactor_test_helpers branch February 15, 2026 21:42
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