@@ -267,6 +267,24 @@ describe('loadRemote', () => {
267
267
reset ( ) ;
268
268
} ) ;
269
269
270
+ it ( 'remote entry url with query' , async ( ) => {
271
+ const FederationInstance = new FederationHost ( {
272
+ name : '@federation-test/compatible' ,
273
+ remotes : [
274
+ {
275
+ name : '__FEDERATION_@federation-test/app2:custom__' ,
276
+ alias : 'app2' ,
277
+ entry :
278
+ 'http://localhost:1111/resources/app2/federation-remote-entry.js?kk=2' ,
279
+ } ,
280
+ ] ,
281
+ } ) ;
282
+ const module =
283
+ await FederationInstance . loadRemote < ( ) => string > ( 'app2/say' ) ;
284
+ assert ( module , 'module should be a function' ) ;
285
+ expect ( module ( ) ) . toBe ( 'hello app2' ) ;
286
+ } ) ;
287
+
270
288
it ( 'different instance with same module' , async ( ) => {
271
289
const reset = addGlobalSnapshot ( {
272
290
'@module-federation/load-remote-different-instance' : {
@@ -399,6 +417,25 @@ describe('loadRemote with manifest.json', () => {
399
417
Global . __FEDERATION__ . __INSTANCES__ = [ ] ;
400
418
globalThis . __FEDERATION__ . __DEBUG_CONSTRUCTOR__ = undefined ;
401
419
} ) ;
420
+
421
+ it ( 'manifest.json with query' , async ( ) => {
422
+ const FM = new FederationHost ( {
423
+ name : '@demo/host' ,
424
+ remotes : [
425
+ {
426
+ name : '@demo/main' ,
427
+ entry :
428
+ 'http://localhost:1111/resources/main/federation-manifest.json?query=2' ,
429
+ } ,
430
+ ] ,
431
+ } ) ;
432
+
433
+ const [ module , , ] = await Promise . all ( [
434
+ FM . loadRemote < Promise < ( ) => string > > ( '@demo/main/say' ) ,
435
+ ] ) ;
436
+ assert ( module ) ;
437
+ expect ( module ( ) ) . toBe ( 'hello world' ) ;
438
+ } ) ;
402
439
} ) ;
403
440
404
441
describe ( 'lazy loadRemote add remote into snapshot' , ( ) => {
@@ -560,7 +597,7 @@ describe('loadRemote', () => {
560
597
const loadedSrcs = [ ...document . querySelectorAll ( 'script' ) ] . map (
561
598
( i ) => i . fakeSrc ,
562
599
) ;
563
- expect ( loadedSrcs . includes ( `${ remotePublicPath } / ${ jsSyncAssetPath } ` ) ) ;
600
+ expect ( loadedSrcs . includes ( `${ remotePublicPath } ${ jsSyncAssetPath } ` ) ) ;
564
601
reset ( ) ;
565
602
} ) ;
566
603
} ) ;
0 commit comments