@@ -259,10 +259,10 @@ describe('generateFontFacesCSS', () => {
259
259
} ) ;
260
260
} ) ;
261
261
262
- describe ( 'getCustomFontPreloadLinks ' , ( ) => {
262
+ describe ( 'getFontSourcesToPreload ' , ( ) => {
263
263
const preloadTestCases = [
264
264
{ 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 } ,
266
266
{ name : 'multiple sources' , font : TEST_FONTS . multiSource , expectedCount : 2 } ,
267
267
{ name : 'missing format' , font : TEST_FONTS . missingFormat , expectedCount : 2 } ,
268
268
{ name : 'empty font faces' , font : TEST_FONTS . empty , expectedCount : 0 } ,
@@ -272,20 +272,9 @@ describe('getCustomFontPreloadLinks', () => {
272
272
273
273
preloadTestCases . forEach ( ( { name, font, expectedCount } ) => {
274
274
test ( `extracts ${ expectedCount } URLs from ${ name } ` , ( ) => {
275
- const result = getFontSourcesToPreload ( font ) ;
275
+ const result = getFontSourcesToPreload ( font ) . flatMap ( ( face ) => face . sources ) ;
276
276
expect ( result ) . toBeArray ( ) ;
277
277
expect ( result . length ) . toBe ( expectedCount ) ;
278
278
} ) ;
279
279
} ) ;
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
- } ) ;
291
280
} ) ;
0 commit comments