refactor: 自定义业务错误
This commit is contained in:
@@ -18,13 +18,13 @@ type AccountRepoSuite struct {
|
||||
suite.Suite
|
||||
ctx context.Context
|
||||
db *gorm.DB
|
||||
repo *AccountRepository
|
||||
repo *accountRepository
|
||||
}
|
||||
|
||||
func (s *AccountRepoSuite) SetupTest() {
|
||||
s.ctx = context.Background()
|
||||
s.db = testTx(s.T())
|
||||
s.repo = NewAccountRepository(s.db)
|
||||
s.repo = NewAccountRepository(s.db).(*accountRepository)
|
||||
}
|
||||
|
||||
func TestAccountRepoSuite(t *testing.T) {
|
||||
@@ -167,7 +167,7 @@ func (s *AccountRepoSuite) TestListWithFilters() {
|
||||
s.Run(tt.name, func() {
|
||||
// 每个 case 重新获取隔离资源
|
||||
db := testTx(s.T())
|
||||
repo := NewAccountRepository(db)
|
||||
repo := NewAccountRepository(db).(*accountRepository)
|
||||
ctx := context.Background()
|
||||
|
||||
tt.setup(db)
|
||||
|
||||
Reference in New Issue
Block a user