mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 17:48:07 +00:00
test: fix list orgs test with sort (#9909)
# Which Problems Are Solved List organization integration test fails sometimes due to incorrect sorting of results. # How the Problems Are Solved Add sorting column to request on list organizations endpoint and sort expected results. # Additional Changes None # Additional Context None
This commit is contained in:
@@ -5,7 +5,9 @@ package org_test
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"slices"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -89,6 +91,7 @@ func TestServer_ListOrganizations(t *testing.T) {
|
|||||||
Queries: []*org.SearchQuery{
|
Queries: []*org.SearchQuery{
|
||||||
OrganizationIdQuery(Instance.DefaultOrg.Id),
|
OrganizationIdQuery(Instance.DefaultOrg.Id),
|
||||||
},
|
},
|
||||||
|
SortingColumn: org.OrganizationFieldName_ORGANIZATION_FIELD_NAME_NAME,
|
||||||
},
|
},
|
||||||
func(ctx context.Context, request *org.ListOrganizationsRequest) ([]orgAttr, error) {
|
func(ctx context.Context, request *org.ListOrganizationsRequest) ([]orgAttr, error) {
|
||||||
count := 3
|
count := 3
|
||||||
@@ -101,6 +104,10 @@ func TestServer_ListOrganizations(t *testing.T) {
|
|||||||
request.Queries = []*org.SearchQuery{
|
request.Queries = []*org.SearchQuery{
|
||||||
OrganizationNamePrefixQuery(prefix),
|
OrganizationNamePrefixQuery(prefix),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slices.SortFunc(orgs, func(a, b orgAttr) int {
|
||||||
|
return -1 * strings.Compare(a.Name, b.Name)
|
||||||
|
})
|
||||||
return orgs, nil
|
return orgs, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user