MSP-5186 Use sql.NullString for description
This commit is contained in:
1 parent
a047fb23dd
commit
9a1e8a7cd4
7 files changed
+52
-30
No files matched your search
+41
-3
@@ -64,7 +64,45 @@ func (s *AppGroupSuite) TestGetByIdList() {
|
||||
appGroups = append(appGroups, domain.AppGroup{
|
||||
Id: appGroup.Id,
|
||||
Name: appGroup.Name,
|
||||
Description: *appGroup.Description,
|
||||
Description: appGroup.Description.String,
|
||||
CreatedAt: time.Time{},
|
||||
UpdatedAt: time.Time{},
|
||||
})
|
||||
ids = append(ids, appGroup.Id)
|
||||
}
|
||||
result := []domain.AppGroup{}
|
||||
apiReq := domain.IdListRequest{IdList: ids}
|
||||
err := s.api.Invoke("system/application_group/get_by_id_list").
|
||||
JsonRequestBody(apiReq).
|
||||
JsonResponseBody(&result).
|
||||
Do(s.T().Context())
|
||||
s.Require().NoError(err)
|
||||
for i := range result {
|
||||
s.Require().NotEmpty(result[i].CreatedAt)
|
||||
result[i].CreatedAt = time.Time{}
|
||||
|
||||
s.Require().NotEmpty(result[i].UpdatedAt)
|
||||
result[i].UpdatedAt = time.Time{}
|
||||
}
|
||||
s.Require().ElementsMatch(appGroups, result)
|
||||
}
|
||||
|
||||
func (s *AppGroupSuite) TestGetByIdList_EmptyDescription() {
|
||||
toGenerate := 10
|
||||
appGroups := make([]domain.AppGroup, 0, toGenerate)
|
||||
ids := make([]int, 0, toGenerate)
|
||||
for range 10 {
|
||||
appGroup, err := s.appGroupRepo.CreateAppGroup(
|
||||
s.T().Context(),
|
||||
fake.It[string](),
|
||||
"",
|
||||
1,
|
||||
)
|
||||
s.Require().NoError(err)
|
||||
appGroups = append(appGroups, domain.AppGroup{
|
||||
Id: appGroup.Id,
|
||||
Name: appGroup.Name,
|
||||
Description: "",
|
||||
CreatedAt: time.Time{},
|
||||
UpdatedAt: time.Time{},
|
||||
})
|
||||
@@ -118,7 +156,7 @@ func (s *AppGroupSuite) TestCreate_HappyPath() {
|
||||
appGroup, err := s.appGroupRepo.GetAppGroupById(s.T().Context(), result.Id)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(apiReq.Name, appGroup.Name)
|
||||
s.Require().Equal(apiReq.Description, *appGroup.Description)
|
||||
s.Require().Equal(apiReq.Description, appGroup.Description.String)
|
||||
}
|
||||
|
||||
func (s *AppGroupSuite) TestCreate_AppGroupNameNotUnique() {
|
||||
@@ -160,7 +198,7 @@ func (s *AppGroupSuite) TestUpdate_HappyPath() {
|
||||
appGroup, err := s.appGroupRepo.GetAppGroupById(s.T().Context(), apiReq.Id)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(apiReq.Name, appGroup.Name)
|
||||
s.Require().Equal(apiReq.Description, *appGroup.Description)
|
||||
s.Require().Equal(apiReq.Description, appGroup.Description.String)
|
||||
}
|
||||
|
||||
func (s *AppGroupSuite) TestUpdate_AppGroupNameNotUnique() {
|
||||
|
||||
@@ -217,11 +217,10 @@ func (s *ApplicationSuite) TestUpdate_HappyPath() {
|
||||
expectedDbApp := entity.Application{
|
||||
Id: apiReq.Id,
|
||||
Name: apiReq.Name,
|
||||
Description: app.Description,
|
||||
Type: inserted[0].Type,
|
||||
ApplicationGroupId: inserted[0].ServiceId,
|
||||
}
|
||||
s.Require().Equal(apiReq.Description, *app.Description)
|
||||
app.Description = nil
|
||||
|
||||
s.Require().NotEmpty(app.CreatedAt)
|
||||
app.CreatedAt = time.Time{}
|
||||
@@ -302,7 +301,7 @@ func (s *ApplicationSuite) insertApps(toInsert []domain.Application) []domain.Ap
|
||||
toExpect = append(toExpect, domain.Application{
|
||||
Id: createdApp.Id,
|
||||
Name: createdApp.Name,
|
||||
Description: *createdApp.Description,
|
||||
Description: createdApp.Description.String,
|
||||
ServiceId: createdApp.ApplicationGroupId,
|
||||
Type: createdApp.Type,
|
||||
CreatedAt: time.Time{},
|
||||
|
||||
Reference in new issue
Block a user