@@ -151,6 +151,7 @@ describe('ui_extension', async () => {
151151 tools : undefined ,
152152 instructions : undefined ,
153153 intents : undefined ,
154+ assets : undefined ,
154155 module : './src/ExtensionPointA.js' ,
155156 metafields : [ { namespace : 'test' , key : 'test' } ] ,
156157 default_placement_reference : undefined ,
@@ -219,6 +220,7 @@ describe('ui_extension', async () => {
219220 tools : undefined ,
220221 instructions : undefined ,
221222 intents : undefined ,
223+ assets : undefined ,
222224 module : './src/ExtensionPointA.js' ,
223225 metafields : [ ] ,
224226 default_placement_reference : 'PLACEMENT_REFERENCE1' ,
@@ -283,6 +285,7 @@ describe('ui_extension', async () => {
283285 tools : undefined ,
284286 instructions : undefined ,
285287 intents : undefined ,
288+ assets : undefined ,
286289 module : './src/ExtensionPointA.js' ,
287290 metafields : [ ] ,
288291 urls : { } ,
@@ -347,6 +350,7 @@ describe('ui_extension', async () => {
347350 tools : undefined ,
348351 instructions : undefined ,
349352 intents : undefined ,
353+ assets : undefined ,
350354 module : './src/ExtensionPointA.js' ,
351355 metafields : [ ] ,
352356 default_placement_reference : undefined ,
@@ -414,6 +418,7 @@ describe('ui_extension', async () => {
414418 tools : undefined ,
415419 instructions : undefined ,
416420 intents : undefined ,
421+ assets : undefined ,
417422 module : './src/ExtensionPointA.js' ,
418423 metafields : [ ] ,
419424 default_placement_reference : undefined ,
@@ -483,6 +488,7 @@ describe('ui_extension', async () => {
483488 tools : undefined ,
484489 instructions : undefined ,
485490 intents : undefined ,
491+ assets : undefined ,
486492 module : './src/ExtensionPointA.js' ,
487493 metafields : [ ] ,
488494 default_placement_reference : undefined ,
@@ -552,6 +558,7 @@ describe('ui_extension', async () => {
552558 tools : './tools.json' ,
553559 instructions : undefined ,
554560 intents : undefined ,
561+ assets : undefined ,
555562 metafields : [ ] ,
556563 default_placement_reference : undefined ,
557564 capabilities : undefined ,
@@ -616,6 +623,72 @@ describe('ui_extension', async () => {
616623 tools : undefined ,
617624 instructions : './instructions.md' ,
618625 intents : undefined ,
626+ assets : undefined ,
627+ metafields : [ ] ,
628+ default_placement_reference : undefined ,
629+ capabilities : undefined ,
630+ preloads : { } ,
631+ build_manifest : {
632+ assets : {
633+ main : {
634+ filepath : 'test-ui-extension.js' ,
635+ module : './src/ExtensionPointA.js' ,
636+ } ,
637+ } ,
638+ } ,
639+ urls : { } ,
640+ } ,
641+ ] )
642+ } )
643+
644+ test ( 'targeting object passes through assets when configured' , async ( ) => {
645+ const allSpecs = await loadLocalExtensionsSpecifications ( )
646+ const specification = allSpecs . find ( ( spec ) => spec . identifier === 'ui_extension' ) !
647+ const configuration = {
648+ targeting : [
649+ {
650+ target : 'EXTENSION::POINT::A' ,
651+ module : './src/ExtensionPointA.js' ,
652+ assets : './assets' ,
653+ } ,
654+ ] ,
655+ api_version : '2023-01' as const ,
656+ name : 'UI Extension' ,
657+ description : 'This is an ordinary test extension' ,
658+ type : 'ui_extension' ,
659+ handle : 'test-ui-extension' ,
660+ capabilities : {
661+ block_progress : false ,
662+ network_access : false ,
663+ api_access : false ,
664+ collect_buyer_consent : {
665+ customer_privacy : true ,
666+ sms_marketing : false ,
667+ } ,
668+ iframe : {
669+ sources : [ ] ,
670+ } ,
671+ } ,
672+ settings : { } ,
673+ }
674+
675+ // When
676+ const parsed = specification . parseConfigurationObject ( configuration )
677+ if ( parsed . state !== 'ok' ) {
678+ throw new Error ( "Couldn't parse configuration" )
679+ }
680+
681+ const got = parsed . data
682+
683+ // Then
684+ expect ( got . extension_points ) . toStrictEqual ( [
685+ {
686+ target : 'EXTENSION::POINT::A' ,
687+ module : './src/ExtensionPointA.js' ,
688+ tools : undefined ,
689+ instructions : undefined ,
690+ intents : undefined ,
691+ assets : './assets' ,
619692 metafields : [ ] ,
620693 default_placement_reference : undefined ,
621694 capabilities : undefined ,
@@ -779,6 +852,7 @@ Please check the configuration in ${uiExtension.configurationPath}`),
779852 tools : './tools.json' ,
780853 instructions : './instructions.md' ,
781854 intents : undefined ,
855+ assets : undefined ,
782856 metafields : [ ] ,
783857 default_placement_reference : undefined ,
784858 capabilities : undefined ,
0 commit comments