Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(SLB-509): add uuid to media content #392

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/decap/src/collections/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ const BlockMediaImageSchema = z
__typename: 'MediaImage',
source: image,
alt,
id: '',
},
caption: caption,
};
Expand All @@ -185,6 +186,7 @@ export const pageSchema = z.object({
__typename: 'MediaImage',
source,
alt: '',
id: '',
}
: undefined,
),
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/src/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
11 changes: 11 additions & 0 deletions tests/schema/specs/blocks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ test('Block: Image with Text', async () => {
... on BlockImageWithText {
image {
__typename
id
}
imagePosition
textContent {
Expand All @@ -427,6 +428,7 @@ test('Block: Image with Text', async () => {
"__typename": "BlockImageWithText",
"image": {
"__typename": "MediaImage",
"id": "3a0fe860-a6d6-428a-9474-365bd57509aa",
},
"imagePosition": "left",
"textContent": {
Expand All @@ -440,6 +442,7 @@ test('Block: Image with Text', async () => {
"__typename": "BlockImageWithText",
"image": {
"__typename": "MediaImage",
"id": "5dfc1856-e9e4-4f02-9cd6-9d888870ce1a",
},
"imagePosition": "right",
"textContent": {
Expand Down Expand Up @@ -467,6 +470,7 @@ test('Block: Image Teasers', async () => {
__typename
image {
__typename
id
}
title
ctaText
Expand All @@ -491,6 +495,7 @@ test('Block: Image Teasers', async () => {
"ctaUrl": "/",
"image": {
"__typename": "MediaImage",
"id": "3a0fe860-a6d6-428a-9474-365bd57509aa",
},
"title": "Image One Teaser Title",
},
Expand All @@ -500,6 +505,7 @@ test('Block: Image Teasers', async () => {
"ctaUrl": "/",
"image": {
"__typename": "MediaImage",
"id": "5dfc1856-e9e4-4f02-9cd6-9d888870ce1a",
},
"title": "Image Two Teaser Title",
},
Expand Down Expand Up @@ -602,9 +608,11 @@ test('Block: Media', async () => {
__typename
... on MediaImage {
__typename
id
}
... on MediaVideo {
__typename
url
}
}
}
Expand All @@ -622,6 +630,7 @@ test('Block: Media', async () => {
"caption": "Media Image Caption",
"media": {
"__typename": "MediaImage",
"id": "5dfc1856-e9e4-4f02-9cd6-9d888870ce1a",
},
},
],
Expand Down Expand Up @@ -677,6 +686,7 @@ test('Block: Quote', async () => {
role
image {
__typename
id
}
}
}
Expand All @@ -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",
Expand Down
18 changes: 18 additions & 0 deletions tests/schema/specs/content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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": [
Expand Down Expand Up @@ -86,6 +103,7 @@ test('Page', async () => {
"path": "/en/page-complete",
"teaserImage": {
"__typename": "MediaImage",
"id": "3a0fe860-a6d6-428a-9474-365bd57509aa",
},
"title": "Page: complete",
},
Expand Down
Loading