Update console tracker page

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-20 11:58:40 +04:00
parent be9b43e98f
commit 5abd670707
12 changed files with 99 additions and 63 deletions

View File

@@ -153,7 +153,7 @@ func TestCookieBanner_Create(t *testing.T) {
query($id: ID!) {
node(id: $id) {
... on CookieBanner {
consentCategories(first: 10) {
categories(first: 10) {
totalCount
edges {
node {
@@ -170,7 +170,7 @@ func TestCookieBanner_Create(t *testing.T) {
var result struct {
Node struct {
ConsentCategories struct {
Categories struct {
TotalCount int `json:"totalCount"`
Edges []struct {
Node struct {
@@ -179,16 +179,16 @@ func TestCookieBanner_Create(t *testing.T) {
Kind string `json:"kind"`
} `json:"node"`
} `json:"edges"`
} `json:"consentCategories"`
} `json:"categories"`
} `json:"node"`
}
err := owner.Execute(query, map[string]any{"id": bannerID}, &result)
require.NoError(t, err)
assert.Greater(t, result.Node.ConsentCategories.TotalCount, 0)
assert.Greater(t, result.Node.Categories.TotalCount, 0)
kinds := make(map[string]bool)
for _, e := range result.Node.ConsentCategories.Edges {
for _, e := range result.Node.Categories.Edges {
kinds[e.Node.Kind] = true
}

View File

@@ -314,7 +314,7 @@ func TestCookieCategory_Delete(t *testing.T) {
query($id: ID!) {
node(id: $id) {
... on CookieBanner {
consentCategories(first: 20) {
categories(first: 20) {
edges {
node {
id
@@ -329,14 +329,14 @@ func TestCookieCategory_Delete(t *testing.T) {
var listResult struct {
Node struct {
ConsentCategories struct {
Categories struct {
Edges []struct {
Node struct {
ID string `json:"id"`
Kind string `json:"kind"`
} `json:"node"`
} `json:"edges"`
} `json:"consentCategories"`
} `json:"categories"`
} `json:"node"`
}
@@ -345,7 +345,7 @@ func TestCookieCategory_Delete(t *testing.T) {
var necessaryCategoryID string
for _, e := range listResult.Node.ConsentCategories.Edges {
for _, e := range listResult.Node.Categories.Edges {
if e.Node.Kind == "NECESSARY" {
necessaryCategoryID = e.Node.ID
break
@@ -423,7 +423,7 @@ func TestCookieCategory_List(t *testing.T) {
query($id: ID!) {
node(id: $id) {
... on CookieBanner {
consentCategories(first: 20, orderBy: {field: RANK, direction: ASC}) {
categories(first: 20, orderBy: {field: RANK, direction: ASC}) {
totalCount
edges {
node {
@@ -443,7 +443,7 @@ func TestCookieCategory_List(t *testing.T) {
var result struct {
Node struct {
ConsentCategories struct {
Categories struct {
TotalCount int `json:"totalCount"`
Edges []struct {
Node struct {
@@ -455,7 +455,7 @@ func TestCookieCategory_List(t *testing.T) {
HasNextPage bool `json:"hasNextPage"`
HasPreviousPage bool `json:"hasPreviousPage"`
} `json:"pageInfo"`
} `json:"consentCategories"`
} `json:"categories"`
} `json:"node"`
}
@@ -463,13 +463,13 @@ func TestCookieCategory_List(t *testing.T) {
require.NoError(t, err)
// Default categories + 2 custom ones
assert.GreaterOrEqual(t, result.Node.ConsentCategories.TotalCount, 4)
assert.GreaterOrEqual(t, result.Node.Categories.TotalCount, 4)
// Verify ordering (ranks should be ascending)
for i := 1; i < len(result.Node.ConsentCategories.Edges); i++ {
for i := 1; i < len(result.Node.Categories.Edges); i++ {
assert.GreaterOrEqual(t,
result.Node.ConsentCategories.Edges[i].Node.Rank,
result.Node.ConsentCategories.Edges[i-1].Node.Rank,
result.Node.Categories.Edges[i].Node.Rank,
result.Node.Categories.Edges[i-1].Node.Rank,
)
}
})