@@ -342,6 +342,7 @@ describe('getEntries via client chain modifiers', () => {
342
342
include : 5 ,
343
343
'sys.id' : entryWithResolvableLink ,
344
344
} )
345
+
345
346
assertLocalizedEntriesResponse ( response )
346
347
} )
347
348
@@ -395,7 +396,8 @@ describe('getEntries via client chain modifiers', () => {
395
396
'sys.id' : entryWithResolvableLink ,
396
397
} )
397
398
398
- assertCSMEntriesResponse ( response )
399
+ const conceptsIncludedInMetadata = true
400
+ assertCSMEntriesResponse ( response , conceptsIncludedInMetadata )
399
401
} )
400
402
401
403
test ( 'enforces entry.sys when query.select is defined' , async ( ) => {
@@ -414,7 +416,8 @@ describe('getEntries via client chain modifiers', () => {
414
416
'sys.id' : entryWithResolvableLink ,
415
417
} )
416
418
417
- assertLocalizedEntriesResponse ( response )
419
+ const conceptsIncludedInMetadata = true
420
+ assertLocalizedEntriesResponse ( response , conceptsIncludedInMetadata )
418
421
expect ( response ?. sys ?. contentSourceMapsLookup ) . toBeDefined ( )
419
422
} )
420
423
@@ -494,7 +497,7 @@ describe('getEntries via client chain modifiers', () => {
494
497
} )
495
498
496
499
// Assertion helpers
497
- function assertLocalizedEntriesResponse ( response ) {
500
+ function assertLocalizedEntriesResponse ( response , conceptsIncludedInMetadata = false ) {
498
501
expect ( response . includes ) . toBeDefined ( )
499
502
expect ( response . includes ! . Asset ) . toBeDefined ( )
500
503
expect ( Object . keys ( response . includes ! . Asset ! ) . length ) . toBeGreaterThan ( 0 )
@@ -503,10 +506,13 @@ function assertLocalizedEntriesResponse(response) {
503
506
504
507
expect ( entry . fields . bestFriend [ 'en-US' ] . fields ) . toBeDefined ( )
505
508
expect ( entry . fields . bestFriend [ 'en-US' ] . sys . type ) . toBe ( 'Entry' )
506
- expect ( entry . metadata ) . toEqual ( { tags : [ ] } )
509
+ expect ( entry . metadata ) . toEqual ( {
510
+ tags : [ ] ,
511
+ ...( conceptsIncludedInMetadata && { concepts : [ ] } ) ,
512
+ } )
507
513
}
508
514
509
- function assertCSMEntriesResponse ( response ) {
515
+ function assertCSMEntriesResponse ( response , conceptsIncludedInMetadata = false ) {
510
516
expect ( response . includes ) . toBeDefined ( )
511
517
expect ( response . includes ! . Asset ) . toBeDefined ( )
512
518
expect ( Object . keys ( response . includes ! . Asset ! ) . length ) . toBeGreaterThan ( 0 )
@@ -515,6 +521,10 @@ function assertCSMEntriesResponse(response) {
515
521
516
522
expect ( entry . fields . bestFriend . fields ) . toBeDefined ( )
517
523
expect ( entry . fields . bestFriend . sys . type ) . toBe ( 'Entry' )
518
- expect ( entry . metadata ) . toEqual ( { tags : [ ] } )
524
+
525
+ expect ( entry . metadata ) . toEqual ( {
526
+ tags : [ ] ,
527
+ ...( conceptsIncludedInMetadata && { concepts : [ ] } ) ,
528
+ } )
519
529
expect ( response . sys ?. contentSourceMapsLookup ) . toBeDefined ( )
520
530
}
0 commit comments