@@ -67,7 +67,7 @@ describe('RepackResolverPlugin', () => {
6767 ) ;
6868
6969 expect ( script . locator . url ) . toBe (
70- 'https://example-manifest.com/remoteEntry.js'
70+ 'https://example-manifest.com/remote1/ remoteEntry.js'
7171 ) ;
7272 } ) ;
7373
@@ -86,7 +86,9 @@ describe('RepackResolverPlugin', () => {
8686 'https://example-entry.com/remoteEntry.js'
8787 ) ;
8888
89- expect ( script . locator . url ) . toBe ( 'https://example-entry.com/remoteEntry.js' ) ;
89+ expect ( script . locator . url ) . toBe (
90+ 'https://example-entry.com/remote1/remoteEntry.js'
91+ ) ;
9092 } ) ;
9193
9294 it ( 'should allow custom configuration when used in runtime with a config object' , async ( ) => {
@@ -152,11 +154,11 @@ describe('RepackResolverPlugin', () => {
152154 'chunk1' ,
153155 'remote1' ,
154156 webpackRequireMock ,
155- 'https://example-entry.com/remote1/assets/nested/ chunk1.js'
157+ 'https://example-entry.com/remote1/assets/chunk1.js'
156158 ) ;
157159
158160 expect ( script . locator . url ) . toBe (
159- 'https://example-manifest.com/remote1/assets/nested/ chunk1.js'
161+ 'https://example-manifest.com/remote1/chunk1.js'
160162 ) ;
161163 expect ( script . locator . headers ) . toEqual ( { authorization : 'Bearer token' } ) ;
162164 expect ( script . locator . fetch ) . toBe ( true ) ;
@@ -184,18 +186,37 @@ describe('RepackResolverPlugin', () => {
184186 it ( 'should rebase the URL from reference URL to entry URL' , async ( ) => {
185187 const plugin = RepackResolverPlugin ( ) ;
186188 // trigger the plugin to register the resolver
187- plugin . afterResolve ! ( { remoteInfo : mockRemoteInfo } as any ) ;
189+ plugin . afterResolve ! ( {
190+ remoteInfo : {
191+ name : 'remote1' ,
192+ entry : 'https://example.com/ios/remote1/entry.container.js.bundle' ,
193+ version : 'https://example-manifest.com/remote1/mf-manifest.json' ,
194+ } ,
195+ } as any ) ;
188196
189197 // manually resolve the script to verify the result
190- const script = await ScriptManager . shared . resolveScript (
198+ const script1 = await ScriptManager . shared . resolveScript (
199+ 'remote1' ,
200+ undefined ,
201+ webpackRequireMock ,
202+ 'https://example.com/ios/remote1/entry.container.js.bundle'
203+ ) ;
204+
205+ // container entry is expected to be at the same level as manifest
206+ expect ( script1 . locator . url ) . toBe (
207+ 'https://example-manifest.com/remote1/entry.container.js.bundle'
208+ ) ;
209+
210+ const script2 = await ScriptManager . shared . resolveScript (
191211 'asset' ,
192212 'remote1' ,
193213 webpackRequireMock ,
194- 'https ://example-entry.com/remote1/subdir /asset.js'
214+ 'http ://localhost:8081/ios/remote1 /asset.js'
195215 ) ;
196216
197- expect ( script . locator . url ) . toBe (
198- 'https://example-manifest.com/remote1/subdir/asset.js'
217+ // all other assets are expected to be at the same level as manifest
218+ expect ( script2 . locator . url ) . toBe (
219+ 'https://example-manifest.com/remote1/asset.js'
199220 ) ;
200221 } ) ;
201222} ) ;
0 commit comments