Skip to content

Commit

Permalink
fix: add color, pattern in svc, test
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jan 9, 2024
1 parent 54c7e04 commit f10ca46
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/service/pet/pet.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ func RawToDto(in *pet.Pet, images []*image_proto.Image) *proto.Pet {
Name: in.Name,
Birthdate: in.Birthdate,
Gender: string(in.Gender),
Color: in.Color,
Pattern: in.Pattern,
Habit: in.Habit,
Caption: in.Caption,
Status: string(in.Status),
Expand Down Expand Up @@ -241,6 +243,8 @@ func DtoToRaw(in *proto.Pet) (res *pet.Pet, err error) {
Name: in.Name,
Birthdate: in.Birthdate,
Gender: gender,
Color: in.Color,
Pattern: in.Pattern,
Habit: in.Habit,
Caption: in.Caption,
Status: status,
Expand Down
22 changes: 22 additions & 0 deletions src/app/service/pet/pet.service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ func (t *PetServiceTest) SetupTest() {
Name: faker.Name(),
Birthdate: faker.Word(),
Gender: genders[rand.Intn(2)],
Color: faker.Word(),
Pattern: faker.Word(),
Habit: faker.Paragraph(),
Caption: faker.Paragraph(),
Status: statuses[rand.Intn(2)],
Expand Down Expand Up @@ -102,6 +104,8 @@ func (t *PetServiceTest) SetupTest() {
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: string(t.Pet.Gender),
Color: t.Pet.Color,
Pattern: t.Pet.Pattern,
Habit: t.Pet.Habit,
Caption: t.Pet.Caption,
Status: string(t.Pet.Status),
Expand All @@ -127,6 +131,8 @@ func (t *PetServiceTest) SetupTest() {
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: t.Pet.Gender,
Color: t.Pet.Color,
Pattern: t.Pet.Pattern,
Habit: t.Pet.Habit,
Caption: t.Pet.Caption,
Status: t.Pet.Status,
Expand All @@ -151,6 +157,8 @@ func (t *PetServiceTest) SetupTest() {
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: t.Pet.Gender,
Color: t.Pet.Color,
Pattern: t.Pet.Pattern,
Habit: t.Pet.Habit,
Caption: t.Pet.Caption,
Status: t.Pet.Status,
Expand All @@ -170,6 +178,8 @@ func (t *PetServiceTest) SetupTest() {
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: string(t.Pet.Gender),
Color: t.Pet.Color,
Pattern: t.Pet.Pattern,
Habit: t.Pet.Habit,
Caption: t.Pet.Caption,
Status: string(t.Pet.Status),
Expand All @@ -192,6 +202,8 @@ func (t *PetServiceTest) SetupTest() {
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: string(t.Pet.Gender),
Color: t.Pet.Color,
Pattern: t.Pet.Pattern,
Habit: t.Pet.Habit,
Caption: t.Pet.Caption,
Status: string(t.Pet.Status),
Expand Down Expand Up @@ -223,6 +235,8 @@ func (t *PetServiceTest) SetupTest() {
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: t.Pet.Gender,
Color: t.Pet.Color,
Pattern: t.Pet.Pattern,
Habit: t.Pet.Habit,
Caption: t.Pet.Caption,
Status: t.Pet.Status,
Expand Down Expand Up @@ -368,6 +382,8 @@ func createPets() []*pet.Pet {
Name: faker.Name(),
Birthdate: faker.Word(),
Gender: genders[rand.Intn(2)],
Color: faker.Word(),
Pattern: faker.Word(),
Habit: faker.Paragraph(),
Caption: faker.Paragraph(),
Status: statuses[rand.Intn(2)],
Expand Down Expand Up @@ -396,6 +412,8 @@ func (t *PetServiceTest) createPetsDto(in []*pet.Pet, imagesList [][]*img_proto.
Name: p.Name,
Birthdate: p.Birthdate,
Gender: string(p.Gender),
Color: p.Color,
Pattern: p.Pattern,
Habit: p.Habit,
Caption: p.Caption,
Status: string(p.Status),
Expand Down Expand Up @@ -427,6 +445,8 @@ func (t *PetServiceTest) TestCreateSuccess() {
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: t.Pet.Gender,
Color: t.Pet.Color,
Pattern: t.Pet.Pattern,
Habit: t.Pet.Habit,
Caption: t.Pet.Caption,
Status: t.Pet.Status,
Expand Down Expand Up @@ -459,6 +479,8 @@ func (t *PetServiceTest) TestCreateInternalErr() {
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: t.Pet.Gender,
Color: t.Pet.Color,
Pattern: t.Pet.Pattern,
Habit: t.Pet.Habit,
Caption: t.Pet.Caption,
Status: t.Pet.Status,
Expand Down

0 comments on commit f10ca46

Please sign in to comment.