refactor: 自定义业务错误
This commit is contained in:
@@ -16,13 +16,13 @@ type GroupRepoSuite struct {
|
||||
suite.Suite
|
||||
ctx context.Context
|
||||
db *gorm.DB
|
||||
repo *GroupRepository
|
||||
repo *groupRepository
|
||||
}
|
||||
|
||||
func (s *GroupRepoSuite) SetupTest() {
|
||||
s.ctx = context.Background()
|
||||
s.db = testTx(s.T())
|
||||
s.repo = NewGroupRepository(s.db)
|
||||
s.repo = NewGroupRepository(s.db).(*groupRepository)
|
||||
}
|
||||
|
||||
func TestGroupRepoSuite(t *testing.T) {
|
||||
@@ -234,11 +234,3 @@ func (s *GroupRepoSuite) TestDeleteAccountGroupsByGroupID_MultipleAccounts() {
|
||||
count, _ := s.repo.GetAccountCount(s.ctx, g.ID)
|
||||
s.Require().Zero(count)
|
||||
}
|
||||
|
||||
// --- DB ---
|
||||
|
||||
func (s *GroupRepoSuite) TestDB() {
|
||||
db := s.repo.DB()
|
||||
s.Require().NotNil(db, "DB should return non-nil")
|
||||
s.Require().Equal(s.db, db, "DB should return the underlying gorm.DB")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user