From 23e1186f0d52b5395abef2529906a28f00e68f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Tue, 5 May 2026 11:15:52 +0400 Subject: [PATCH] Fix e2e tests for consentCategories rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- e2e/console/cookie_banner_test.go | 10 +++--- e2e/console/cookie_category_test.go | 56 ++++++++++++++--------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/e2e/console/cookie_banner_test.go b/e2e/console/cookie_banner_test.go index 6770d2a95..826a2d945 100644 --- a/e2e/console/cookie_banner_test.go +++ b/e2e/console/cookie_banner_test.go @@ -159,7 +159,7 @@ func TestCookieBanner_Create(t *testing.T) { query($id: ID!) { node(id: $id) { ... on CookieBanner { - categories(first: 10) { + consentCategories(first: 10) { totalCount edges { node { @@ -176,7 +176,7 @@ func TestCookieBanner_Create(t *testing.T) { var result struct { Node struct { - Categories struct { + ConsentCategories struct { TotalCount int `json:"totalCount"` Edges []struct { Node struct { @@ -185,16 +185,16 @@ func TestCookieBanner_Create(t *testing.T) { Kind string `json:"kind"` } `json:"node"` } `json:"edges"` - } `json:"categories"` + } `json:"consentCategories"` } `json:"node"` } err := owner.Execute(query, map[string]any{"id": bannerID}, &result) require.NoError(t, err) - assert.Greater(t, result.Node.Categories.TotalCount, 0) + assert.Greater(t, result.Node.ConsentCategories.TotalCount, 0) kinds := make(map[string]bool) - for _, e := range result.Node.Categories.Edges { + for _, e := range result.Node.ConsentCategories.Edges { kinds[e.Node.Kind] = true } assert.True(t, kinds["NECESSARY"], "should have a NECESSARY category") diff --git a/e2e/console/cookie_category_test.go b/e2e/console/cookie_category_test.go index 5d62758ab..a3f0f6e99 100644 --- a/e2e/console/cookie_category_test.go +++ b/e2e/console/cookie_category_test.go @@ -313,7 +313,7 @@ func TestCookieCategory_Delete(t *testing.T) { query($id: ID!) { node(id: $id) { ... on CookieBanner { - categories(first: 20) { + consentCategories(first: 20) { edges { node { id @@ -328,14 +328,14 @@ func TestCookieCategory_Delete(t *testing.T) { var listResult struct { Node struct { - Categories struct { - Edges []struct { - Node struct { - ID string `json:"id"` - Kind string `json:"kind"` - } `json:"node"` - } `json:"edges"` - } `json:"categories"` + ConsentCategories struct { + Edges []struct { + Node struct { + ID string `json:"id"` + Kind string `json:"kind"` + } `json:"node"` + } `json:"edges"` + } `json:"consentCategories"` } `json:"node"` } @@ -343,7 +343,7 @@ func TestCookieCategory_Delete(t *testing.T) { require.NoError(t, err) var necessaryCategoryID string - for _, e := range listResult.Node.Categories.Edges { + for _, e := range listResult.Node.ConsentCategories.Edges { if e.Node.Kind == "NECESSARY" { necessaryCategoryID = e.Node.ID break @@ -420,7 +420,7 @@ func TestCookieCategory_List(t *testing.T) { query($id: ID!) { node(id: $id) { ... on CookieBanner { - categories(first: 20, orderBy: {field: RANK, direction: ASC}) { + consentCategories(first: 20, orderBy: {field: RANK, direction: ASC}) { totalCount edges { node { @@ -440,19 +440,19 @@ func TestCookieCategory_List(t *testing.T) { var result struct { Node struct { - Categories struct { - TotalCount int `json:"totalCount"` - Edges []struct { - Node struct { - ID string `json:"id"` - Rank int `json:"rank"` - } `json:"node"` - } `json:"edges"` - PageInfo struct { - HasNextPage bool `json:"hasNextPage"` - HasPreviousPage bool `json:"hasPreviousPage"` - } `json:"pageInfo"` - } `json:"categories"` + ConsentCategories struct { + TotalCount int `json:"totalCount"` + Edges []struct { + Node struct { + ID string `json:"id"` + Rank int `json:"rank"` + } `json:"node"` + } `json:"edges"` + PageInfo struct { + HasNextPage bool `json:"hasNextPage"` + HasPreviousPage bool `json:"hasPreviousPage"` + } `json:"pageInfo"` + } `json:"consentCategories"` } `json:"node"` } @@ -460,13 +460,13 @@ func TestCookieCategory_List(t *testing.T) { require.NoError(t, err) // Default categories + 2 custom ones - assert.GreaterOrEqual(t, result.Node.Categories.TotalCount, 4) + assert.GreaterOrEqual(t, result.Node.ConsentCategories.TotalCount, 4) // Verify ordering (ranks should be ascending) - for i := 1; i < len(result.Node.Categories.Edges); i++ { + for i := 1; i < len(result.Node.ConsentCategories.Edges); i++ { assert.GreaterOrEqual(t, - result.Node.Categories.Edges[i].Node.Rank, - result.Node.Categories.Edges[i-1].Node.Rank, + result.Node.ConsentCategories.Edges[i].Node.Rank, + result.Node.ConsentCategories.Edges[i-1].Node.Rank, ) } })