Skip to content

Commit

Permalink
Include unique option
Browse files Browse the repository at this point in the history
  • Loading branch information
ecdatadog committed Jan 9, 2025
1 parent 14f31da commit bd2a3d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestMarshal(t *testing.T) {
given any
expect string
expectError error
opts []MarshalOption
}{
{
description: "nil",
Expand Down Expand Up @@ -86,6 +87,7 @@ func TestMarshal(t *testing.T) {
given: articlesAA,
expect: "",
expectError: ErrNonuniqueResource,
opts: []MarshalOption{MarshallCheckUniqueness()},
}, {
description: "[]*Article",
given: articlesABPtr,
Expand Down Expand Up @@ -592,7 +594,7 @@ func TestMarshalRelationships(t *testing.T) {
}, {
description: "with related nonunique comments",
given: &articleRelatedNonuniqueComments,
marshalOptions: nil,
marshalOptions: []MarshalOption{MarshallCheckUniqueness()},
expect: "",
expectError: ErrNonuniqueResource,
}, {
Expand Down
4 changes: 2 additions & 2 deletions unmarshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestUnmarshal(t *testing.T) {
given: articlesABNonuniqueData,
do: func(body []byte) (any, error) {
var a []Article
err := Unmarshal(body, &a)
err := Unmarshal(body, &a, UnmarshalCheckUniqueness())
return a, err
},
expect: ([]Article)(nil),
Expand Down Expand Up @@ -430,7 +430,7 @@ func TestUnmarshal(t *testing.T) {
given: articleRelatedNonuniqueLinkage,
do: func(body []byte) (any, error) {
var a ArticleRelated
err := Unmarshal(body, &a)
err := Unmarshal(body, &a, UnmarshalCheckUniqueness())
return a, err
},
expect: ArticleRelated{},
Expand Down

0 comments on commit bd2a3d5

Please sign in to comment.