@@ -651,6 +651,68 @@ describe('rsc-mf host modern.server middleware contracts', () => {
651651 await expect ( context . res ?. text ( ) ) . resolves . toBe ( 'query-fallback-hit' ) ;
652652 } ) ;
653653
654+ it ( 'matches fallback chunks when manifest hash suffix includes non-hex characters' , async ( ) => {
655+ const handler = getProxyMiddlewareHandler ( ) ;
656+ const next = jest . fn ( async ( ) : Promise < void > => undefined ) ;
657+ const fetchMock = installFetchMock (
658+ jest
659+ . fn ( )
660+ . mockResolvedValueOnce ( new Response ( 'not-found' , { status : 404 } ) )
661+ . mockResolvedValueOnce (
662+ new Response (
663+ JSON . stringify ( {
664+ exposes : [
665+ {
666+ assets : {
667+ js : {
668+ sync : [
669+ 'static/js/async/__federation_expose_RemoteServerCard.a1b2c3x9.js' ,
670+ ] ,
671+ async : [ ] ,
672+ } ,
673+ css : {
674+ sync : [ ] ,
675+ async : [ ] ,
676+ } ,
677+ } ,
678+ } ,
679+ ] ,
680+ } ) ,
681+ {
682+ status : 200 ,
683+ headers : {
684+ 'content-type' : 'application/json' ,
685+ } ,
686+ } ,
687+ ) ,
688+ )
689+ . mockResolvedValueOnce (
690+ new Response ( 'non-hex-hash-fallback-hit' , {
691+ status : 200 ,
692+ headers : {
693+ 'content-type' : 'application/javascript' ,
694+ } ,
695+ } ) ,
696+ ) ,
697+ ) ;
698+ const context : { req : { url : string } ; res ?: Response } = {
699+ req : {
700+ url : 'http://127.0.0.1:3007/static/js/async/__federation_expose_RemoteServerCard.js' ,
701+ } ,
702+ } ;
703+
704+ await withRemotePort ( '3999' , ( ) => handler ( context , next ) ) ;
705+
706+ expect ( fetchMock ) . toHaveBeenNthCalledWith (
707+ 3 ,
708+ 'http://127.0.0.1:3999/static/js/async/__federation_expose_RemoteServerCard.a1b2c3x9.js' ,
709+ ) ;
710+ expect ( next ) . not . toHaveBeenCalled ( ) ;
711+ await expect ( context . res ?. text ( ) ) . resolves . toBe (
712+ 'non-hex-hash-fallback-hit' ,
713+ ) ;
714+ } ) ;
715+
654716 it ( 'resolves fallback asset paths from manifest async asset arrays' , async ( ) => {
655717 const handler = getProxyMiddlewareHandler ( ) ;
656718 const next = jest . fn ( async ( ) : Promise < void > => undefined ) ;
0 commit comments