Skip to content

Commit dcb36f6

Browse files
committed
chore: update graphQL int tests
1 parent 8879834 commit dcb36f6

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

test/localization/int.spec.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3183,28 +3183,33 @@ describe('Localization', () => {
31833183
describe('GraphQL', () => {
31843184
describe('Collections', () => {
31853185
it('should allow fallback locale to be an array', async () => {
3186-
const query = `query {
3187-
LocalizedPost(id: "${postWithLocalizedData.id}") {
3188-
title
3189-
}
3190-
}`
3186+
const query = `
3187+
{
3188+
LocalizedPost(id: ${idToString(postWithLocalizedData.id, payload)}, locale: pt) {
3189+
title
3190+
}
3191+
}
3192+
`
31913193

3192-
const { data: queryResult } = await restClient
3194+
const { data } = await restClient
31933195
.GRAPHQL_POST({
31943196
body: JSON.stringify({ query }),
31953197
query: { locale: 'pt', fallbackLocale: '[es, en]' },
31963198
})
31973199
.then((res) => res.json())
3200+
console.log(data)
31983201

3199-
expect(queryResult.LocalizedPost.title).toBe(spanishTitle)
3202+
expect(data.LocalizedPost.title).toStrictEqual(spanishTitle)
32003203
})
32013204

32023205
it('should pass over fallback locales until it finds one that exists', async () => {
3203-
const query = `query {
3204-
LocalizedPost(id: "${postWithLocalizedData.id}") {
3205-
title
3206-
}
3207-
}`
3206+
const query = `
3207+
{
3208+
LocalizedPost(id: ${idToString(postWithLocalizedData.id, payload)}, locale: pt) {
3209+
title
3210+
}
3211+
}
3212+
`
32083213

32093214
const { data: queryResult } = await restClient
32103215
.GRAPHQL_POST({
@@ -3217,11 +3222,13 @@ describe('Localization', () => {
32173222
})
32183223

32193224
it('should return null if no fallback locales exist', async () => {
3220-
const query = `query {
3221-
LocalizedPost(id: "${postWithLocalizedData.id}") {
3222-
title
3223-
}
3224-
}`
3225+
const query = `
3226+
{
3227+
LocalizedPost(id: ${idToString(postWithLocalizedData.id, payload)}, locale: pt) {
3228+
title
3229+
}
3230+
}
3231+
`
32253232

32263233
const { data: queryResult } = await restClient
32273234
.GRAPHQL_POST({

0 commit comments

Comments
 (0)