Skip to content

Commit 95bf06c

Browse files
committed
test(rsc-mf): cover remote entry URL normalization in runtime plugin
1 parent 1b8615c commit 95bf06c

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

tests/integration/rsc-mf/tests/forceRemotePublicPath.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,34 @@ describe('host forceRemotePublicPath runtime plugin', () => {
8383
);
8484
});
8585

86+
it('normalizes entry URL query, hash, and default port in rewritten paths', () => {
87+
const plugin = forceRemotePublicPath();
88+
const args = {
89+
remoteInfo: {
90+
alias: 'rscRemote',
91+
entry:
92+
'https://remote.example.com:443/static/mf-manifest.json?cache=1#v',
93+
},
94+
remoteSnapshot: {
95+
publicPath: 'https://stale.example.com/static/',
96+
metaData: {
97+
publicPath: 'https://stale.example.com/static/',
98+
ssrPublicPath: 'https://stale.example.com/static/bundles/',
99+
},
100+
},
101+
};
102+
103+
plugin.loadRemoteSnapshot?.(args as any);
104+
105+
expect(args.remoteSnapshot.publicPath).toBe('https://remote.example.com/');
106+
expect(args.remoteSnapshot.metaData.publicPath).toBe(
107+
'https://remote.example.com/',
108+
);
109+
expect(args.remoteSnapshot.metaData.ssrPublicPath).toBe(
110+
'https://remote.example.com/bundles/',
111+
);
112+
});
113+
86114
it('only updates snapshot fields that exist', () => {
87115
const plugin = forceRemotePublicPath();
88116
const args = {

0 commit comments

Comments
 (0)