From 044acf0b804a0a439d13cd64aa32304bdd6f665b Mon Sep 17 00:00:00 2001 From: HagerDakroury Date: Thu, 9 Jan 2025 18:08:34 +0100 Subject: [PATCH] test(SLB-509): add uuid to media content --- apps/decap/src/collections/page.ts | 2 ++ packages/schema/src/schema.graphql | 2 +- tests/schema/specs/blocks.spec.ts | 11 +++++++++++ tests/schema/specs/content.spec.ts | 18 ++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/apps/decap/src/collections/page.ts b/apps/decap/src/collections/page.ts index 9a990aa87..9c9dde090 100644 --- a/apps/decap/src/collections/page.ts +++ b/apps/decap/src/collections/page.ts @@ -161,6 +161,7 @@ const BlockMediaImageSchema = z __typename: 'MediaImage', source: image, alt, + id: '', }, caption: caption, }; @@ -185,6 +186,7 @@ export const pageSchema = z.object({ __typename: 'MediaImage', source, alt: '', + id: '', } : undefined, ), diff --git a/packages/schema/src/schema.graphql b/packages/schema/src/schema.graphql index 4682680fa..e28a7e697 100644 --- a/packages/schema/src/schema.graphql +++ b/packages/schema/src/schema.graphql @@ -266,7 +266,7 @@ type MediaImage @type(id: "image") @entity(type: "media", bundle: "image") { sizes: "$sizes" transform: "$transform" ) - + id: ID! @resolveEntityUuid alt: String! @resolveProperty(path: "field_media_image.alt") } diff --git a/tests/schema/specs/blocks.spec.ts b/tests/schema/specs/blocks.spec.ts index 0dc80e7d7..c099b3921 100644 --- a/tests/schema/specs/blocks.spec.ts +++ b/tests/schema/specs/blocks.spec.ts @@ -407,6 +407,7 @@ test('Block: Image with Text', async () => { ... on BlockImageWithText { image { __typename + id } imagePosition textContent { @@ -427,6 +428,7 @@ test('Block: Image with Text', async () => { "__typename": "BlockImageWithText", "image": { "__typename": "MediaImage", + "id": "3a0fe860-a6d6-428a-9474-365bd57509aa", }, "imagePosition": "left", "textContent": { @@ -440,6 +442,7 @@ test('Block: Image with Text', async () => { "__typename": "BlockImageWithText", "image": { "__typename": "MediaImage", + "id": "5dfc1856-e9e4-4f02-9cd6-9d888870ce1a", }, "imagePosition": "right", "textContent": { @@ -467,6 +470,7 @@ test('Block: Image Teasers', async () => { __typename image { __typename + id } title ctaText @@ -491,6 +495,7 @@ test('Block: Image Teasers', async () => { "ctaUrl": "/", "image": { "__typename": "MediaImage", + "id": "3a0fe860-a6d6-428a-9474-365bd57509aa", }, "title": "Image One Teaser Title", }, @@ -500,6 +505,7 @@ test('Block: Image Teasers', async () => { "ctaUrl": "/", "image": { "__typename": "MediaImage", + "id": "5dfc1856-e9e4-4f02-9cd6-9d888870ce1a", }, "title": "Image Two Teaser Title", }, @@ -602,9 +608,11 @@ test('Block: Media', async () => { __typename ... on MediaImage { __typename + id } ... on MediaVideo { __typename + url } } } @@ -622,6 +630,7 @@ test('Block: Media', async () => { "caption": "Media Image Caption", "media": { "__typename": "MediaImage", + "id": "5dfc1856-e9e4-4f02-9cd6-9d888870ce1a", }, }, ], @@ -677,6 +686,7 @@ test('Block: Quote', async () => { role image { __typename + id } } } @@ -693,6 +703,7 @@ test('Block: Quote', async () => { "author": "Rose (Betty White)", "image": { "__typename": "MediaImage", + "id": "5dfc1856-e9e4-4f02-9cd6-9d888870ce1a", }, "quote": "My mother always used to say: The older you get, the better you get, unless you’re a banana.", "role": "TheGoldenGirls", diff --git a/tests/schema/specs/content.spec.ts b/tests/schema/specs/content.spec.ts index a107c4a3e..b0ace7e39 100644 --- a/tests/schema/specs/content.spec.ts +++ b/tests/schema/specs/content.spec.ts @@ -11,12 +11,23 @@ test('Page', async () => { title teaserImage { __typename + id } hero { __typename + image { + id + } } content { __typename + ... on BlockMedia { + media { + ... on MediaImage { + id + } + } + } } metaTags { tag @@ -45,10 +56,16 @@ test('Page', async () => { }, { "__typename": "BlockMedia", + "media": { + "id": "72187a1f-3e48-4b45-a9b7-189c6fd7ee26", + }, }, ], "hero": { "__typename": "Hero", + "image": { + "id": "3a0fe860-a6d6-428a-9474-365bd57509aa", + }, }, "locale": "en", "metaTags": [ @@ -86,6 +103,7 @@ test('Page', async () => { "path": "/en/page-complete", "teaserImage": { "__typename": "MediaImage", + "id": "3a0fe860-a6d6-428a-9474-365bd57509aa", }, "title": "Page: complete", },