@@ -3183,28 +3183,33 @@ describe('Localization', () => {
3183
3183
describe ( 'GraphQL' , ( ) => {
3184
3184
describe ( 'Collections' , ( ) => {
3185
3185
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
+ `
3191
3193
3192
- const { data : queryResult } = await restClient
3194
+ const { data } = await restClient
3193
3195
. GRAPHQL_POST ( {
3194
3196
body : JSON . stringify ( { query } ) ,
3195
3197
query : { locale : 'pt' , fallbackLocale : '[es, en]' } ,
3196
3198
} )
3197
3199
. then ( ( res ) => res . json ( ) )
3200
+ console . log ( data )
3198
3201
3199
- expect ( queryResult . LocalizedPost . title ) . toBe ( spanishTitle )
3202
+ expect ( data . LocalizedPost . title ) . toStrictEqual ( spanishTitle )
3200
3203
} )
3201
3204
3202
3205
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
+ `
3208
3213
3209
3214
const { data : queryResult } = await restClient
3210
3215
. GRAPHQL_POST ( {
@@ -3217,11 +3222,13 @@ describe('Localization', () => {
3217
3222
} )
3218
3223
3219
3224
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
+ `
3225
3232
3226
3233
const { data : queryResult } = await restClient
3227
3234
. GRAPHQL_POST ( {
0 commit comments