mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 05:11:34 +00:00
Introduced a new testing strategy for the data access layer to avoid redundant testing of generic repository methods. - Created a comprehensive test suite for the generic `BaseRepository` using a dedicated `TestEntity`. This suite covers all common CRUD operations, including transactions and error handling, in a single location. - Added a new, focused test suite for `CategoryRepository` that only tests its repository-specific methods, relying on the base repository tests for generic functionality. - Refactored the existing `AuthorRepository` test suite to remove redundant CRUD tests, aligning it with the new, cleaner pattern. - Updated the test utilities to support the new testing strategy. This change significantly improves the maintainability and efficiency of the test suite and provides a clear, future-proof pattern for testing all repositories.
11 lines
214 B
Go
11 lines
214 B
Go
package testutil
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
// TestEntity is a simple struct used for testing the generic BaseRepository.
|
|
// It is not used in the main application.
|
|
type TestEntity struct {
|
|
gorm.Model
|
|
Name string
|
|
}
|