Skip to content

Commit

Permalink
fix: add extra check on list schemas test for navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
shipperizer committed Apr 12, 2024
1 parent 7bdd3e7 commit 2afec86
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/schemas/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func TestHandleListSuccess(t *testing.T) {
// duplicate types.Response attribute we care and assign the proper type instead of interface{}
type Response struct {
Data []kClient.IdentitySchemaContainer `json:"data"`
Meta types.Pagination `json:"_meta"`
}

rr := new(Response)
Expand All @@ -146,6 +147,10 @@ func TestHandleListSuccess(t *testing.T) {
t.Fatalf("invalid result, expected %v schemas, got: %v", len(schemas.IdentitySchemas), len(rr.Data))
}

if schemas.Tokens.Next != rr.Meta.Next || schemas.Tokens.Prev != rr.Meta.Prev {
t.Fatalf("pagination links invalid, expected %v got %v", schemas.Tokens, rr.Meta)
}

if !reflect.DeepEqual([]string{*schemas.IdentitySchemas[0].Id, *schemas.IdentitySchemas[1].Id}, []string{*rr.Data[0].Id, *rr.Data[1].Id}) {
t.Fatalf("invalid result, expected: %v, got: %v", schemas.IdentitySchemas, rr.Data)
}
Expand Down

0 comments on commit 2afec86

Please sign in to comment.