@@ -259,10 +259,10 @@ describe('generateFontFacesCSS', () => {
259259 } ) ;
260260} ) ;
261261
262- describe ( 'getCustomFontPreloadLinks ' , ( ) => {
262+ describe ( 'getFontSourcesToPreload ' , ( ) => {
263263 const preloadTestCases = [
264264 { name : 'basic case' , font : TEST_FONTS . basic , expectedCount : 2 } ,
265- { name : 'multiple weights' , font : TEST_FONTS . multiWeight , expectedCount : 5 } ,
265+ { name : 'multiple weights' , font : TEST_FONTS . multiWeight , expectedCount : 2 } ,
266266 { name : 'multiple sources' , font : TEST_FONTS . multiSource , expectedCount : 2 } ,
267267 { name : 'missing format' , font : TEST_FONTS . missingFormat , expectedCount : 2 } ,
268268 { name : 'empty font faces' , font : TEST_FONTS . empty , expectedCount : 0 } ,
@@ -272,20 +272,9 @@ describe('getCustomFontPreloadLinks', () => {
272272
273273 preloadTestCases . forEach ( ( { name, font, expectedCount } ) => {
274274 test ( `extracts ${ expectedCount } URLs from ${ name } ` , ( ) => {
275- const result = getFontSourcesToPreload ( font ) ;
275+ const result = getFontSourcesToPreload ( font ) . flatMap ( ( face ) => face . sources ) ;
276276 expect ( result ) . toBeArray ( ) ;
277277 expect ( result . length ) . toBe ( expectedCount ) ;
278278 } ) ;
279279 } ) ;
280-
281- test ( 'handles different URL types correctly' , ( ) => {
282- const result = getFontSourcesToPreload ( TEST_FONTS . variousURLs ) ;
283-
284- expect ( result ) . toBeArray ( ) ;
285- expect ( result . length ) . toBe ( 2 ) ;
286- expect ( result ) . toMatchObject ( [
287- { url : 'https://example.com/fonts.woff2' } ,
288- { url : 'https://example.com/fonts.woff' } ,
289- ] ) ;
290- } ) ;
291280} ) ;
0 commit comments