@@ -783,7 +783,7 @@ describe('fonts infra', () => {
783783 address : { address : '127.0.0.1' , family : 'IPv4' , port : 3000 } ,
784784 } ) ;
785785
786- assert . equal ( resolver . resolve ( '/_astro/fonts/bar.woff2' ) , null ) ;
786+ assert . equal ( resolver . resolve ( '/_astro/fonts/bar.woff2' , undefined ) , null ) ;
787787 } ) ;
788788
789789 it ( 'works with ipv4' , ( ) => {
@@ -793,7 +793,7 @@ describe('fonts infra', () => {
793793 } ) ;
794794
795795 assert . equal (
796- resolver . resolve ( '/test/_astro/fonts/foo.woff2' ) ,
796+ resolver . resolve ( '/test/_astro/fonts/foo.woff2' , undefined ) ,
797797 'http://127.0.0.1:3000/test/_astro/fonts/foo.woff2' ,
798798 ) ;
799799 } ) ;
@@ -805,7 +805,7 @@ describe('fonts infra', () => {
805805 } ) ;
806806
807807 assert . equal (
808- resolver . resolve ( '/_astro/fonts/foo.woff2' ) ,
808+ resolver . resolve ( '/_astro/fonts/foo.woff2' , undefined ) ,
809809 'http://[::]:3000/_astro/fonts/foo.woff2' ,
810810 ) ;
811811 } ) ;
@@ -817,10 +817,37 @@ describe('fonts infra', () => {
817817 } ) ;
818818
819819 assert . equal (
820- resolver . resolve ( 'http://cdn.example.com/_astro/fonts/foo.woff2' ) ,
820+ resolver . resolve ( 'http://cdn.example.com/_astro/fonts/foo.woff2' , undefined ) ,
821821 'http://127.0.0.1:3000/_astro/fonts/foo.woff2' ,
822822 ) ;
823823 } ) ;
824+
825+ it ( 'falls back to requestUrl when address is null' , ( ) => {
826+ const resolver = new RemoteRuntimeFontFileUrlResolver ( {
827+ urls : new Set ( [ '/_astro/fonts/foo.woff2' ] ) ,
828+ address : null ,
829+ } ) ;
830+
831+ assert . equal (
832+ resolver . resolve (
833+ '/_astro/fonts/foo.woff2' ,
834+ new URL ( 'http://localhost:4321/og.png' ) ,
835+ ) ,
836+ 'http://localhost:4321/_astro/fonts/foo.woff2' ,
837+ ) ;
838+ } ) ;
839+
840+ it ( 'returns full url directly when address is null and url is absolute (assetsPrefix)' , ( ) => {
841+ const resolver = new RemoteRuntimeFontFileUrlResolver ( {
842+ urls : new Set ( [ 'http://cdn.example.com/_astro/fonts/foo.woff2' ] ) ,
843+ address : null ,
844+ } ) ;
845+
846+ assert . equal (
847+ resolver . resolve ( 'http://cdn.example.com/_astro/fonts/foo.woff2' , undefined ) ,
848+ 'http://cdn.example.com/_astro/fonts/foo.woff2' ,
849+ ) ;
850+ } ) ;
824851 } ) ;
825852
826853 describe ( 'SsrRuntimeFontFileUrlResolver' , ( ) => {
0 commit comments