Skip to content

Commit

Permalink
added validation in test.
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <jortel@redhat.com>
  • Loading branch information
jortel committed Jun 11, 2024
1 parent 7ea244b commit b823a74
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions model/model_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package model

import (
"encoding/json"
"testing"

"github.com/onsi/gomega"
Expand Down Expand Up @@ -35,6 +36,14 @@ func TestMapArrayStruct(t *testing.T) {
g.Expect(list[1].(Attachment).ID).To(gomega.Equal(in[1].ID))
g.Expect(list[0].(Attachment).Activity).To(gomega.Equal(in[0].Activity))
g.Expect(list[1].(Attachment).Activity).To(gomega.Equal(in[1].Activity))

m, err := json.Marshal(list[0])
g.Expect(err).To(gomega.BeNil())
m2 := make(map[string]any)
err = json.Unmarshal(m, &m2)
g.Expect(err).To(gomega.BeNil())
g.Expect(m2["id"]).To(gomega.Equal(float64(1)))
g.Expect(m2["activity"]).To(gomega.Equal(float64(18)))
}

func TestMapData(t *testing.T) {
Expand Down

0 comments on commit b823a74

Please # to comment.