2022-09-22 00:10:24 +02:00
import loader from '@next/font/google/loader'
import fetch from 'next/dist/compiled/node-fetch'
jest . mock ( 'next/dist/compiled/node-fetch' )
2023-02-16 15:33:39 +01:00
describe ( 'next/font/google loader' , ( ) = > {
2022-09-22 00:10:24 +02:00
afterEach ( ( ) = > {
jest . resetAllMocks ( )
} )
describe ( 'URL from options' , ( ) = > {
test . each ( [
[
'Inter' ,
{ } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap' ,
2022-09-22 00:10:24 +02:00
] ,
[
'Inter' ,
2022-10-20 19:42:19 +02:00
{ weight : '400' } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Inter:wght@400&display=swap' ,
2022-09-22 00:10:24 +02:00
] ,
[
'Inter' ,
2022-10-20 19:42:19 +02:00
{ weight : '900' , display : 'block' } ,
2022-09-22 00:10:24 +02:00
'https://fonts.googleapis.com/css2?family=Inter:wght@900&display=block' ,
] ,
[
'Source_Sans_Pro' ,
2022-10-20 19:42:19 +02:00
{ weight : '900' , display : 'auto' } ,
2022-09-22 00:10:24 +02:00
'https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@900&display=auto' ,
] ,
[
'Source_Sans_Pro' ,
2022-10-20 19:42:19 +02:00
{ weight : '200' , style : 'italic' } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@1,200&display=swap' ,
2022-09-22 00:10:24 +02:00
] ,
[
'Roboto_Flex' ,
{ display : 'swap' } ,
'https://fonts.googleapis.com/css2?family=Roboto+Flex:wght@100..1000&display=swap' ,
] ,
[
'Roboto_Flex' ,
2022-10-20 19:42:19 +02:00
{ display : 'fallback' , weight : 'variable' , axes : [ 'opsz' ] } ,
2022-09-22 00:10:24 +02:00
'https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,100..1000&display=fallback' ,
] ,
[
'Roboto_Flex' ,
{
display : 'optional' ,
axes : [ 'YTUC' , 'slnt' , 'wdth' , 'opsz' , 'XTRA' , 'YTAS' ] ,
} ,
'https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,slnt,wdth,wght,XTRA,YTAS,YTUC@8..144,-10..0,25..151,100..1000,323..603,649..854,528..760&display=optional' ,
] ,
[
'Oooh_Baby' ,
2022-10-20 19:42:19 +02:00
{ weight : '400' } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Oooh+Baby:wght@400&display=swap' ,
2022-09-22 00:10:24 +02:00
] ,
[
'Albert_Sans' ,
2022-10-20 19:42:19 +02:00
{ weight : 'variable' , style : 'italic' } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Albert+Sans:ital,wght@1,100..900&display=swap' ,
2022-09-22 00:10:24 +02:00
] ,
[
'Fraunces' ,
2022-10-20 19:42:19 +02:00
{ weight : 'variable' , style : 'italic' , axes : [ 'WONK' , 'opsz' , 'SOFT' ] } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT,WONK@1,9..144,100..900,0..100,0..1&display=swap' ,
2022-09-22 00:10:24 +02:00
] ,
2022-10-20 19:42:19 +02:00
[
'Molle' ,
{ weight : '400' } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Molle:ital,wght@1,400&display=swap' ,
2022-10-20 19:42:19 +02:00
] ,
2022-11-03 19:21:32 +01:00
[
'Roboto' ,
{ weight : [ '500' , '300' , '400' ] , style : [ 'normal' , 'italic' ] } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&display=swap' ,
2022-11-03 19:21:32 +01:00
] ,
[
'Roboto Mono' ,
{ style : [ 'italic' , 'normal' ] } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap' ,
2022-11-03 19:21:32 +01:00
] ,
[
'Fraunces' ,
{
style : [ 'normal' , 'italic' ] ,
axes : [ 'WONK' , 'opsz' , 'SOFT' ] ,
} ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT,WONK@0,9..144,100..900,0..100,0..1;1,9..144,100..900,0..100,0..1&display=swap' ,
2022-11-03 19:21:32 +01:00
] ,
[
'Poppins' ,
{ weight : [ '900' , '400' , '100' ] } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Poppins:wght@100;400;900&display=swap' ,
2022-11-03 19:21:32 +01:00
] ,
2022-11-17 17:52:19 +01:00
[
'Nabla' ,
{ } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Nabla&display=swap' ,
2022-11-17 17:52:19 +01:00
] ,
[
'Nabla' ,
{ axes : [ 'EDPT' , 'EHLT' ] } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Nabla:EDPT,EHLT@0..200,0..24&display=swap' ,
2022-11-17 17:52:19 +01:00
] ,
[
'Ballet' ,
{ } ,
2023-01-31 17:26:38 +01:00
'https://fonts.googleapis.com/css2?family=Ballet&display=swap' ,
2022-11-17 17:52:19 +01:00
] ,
2022-09-22 00:10:24 +02:00
] ) ( '%s' , async ( functionName : string , data : any , url : string ) = > {
fetch . mockResolvedValue ( {
ok : true ,
text : async ( ) = > 'OK' ,
} )
const { css } = await loader ( {
functionName ,
data : [ { adjustFontFallback : false , . . . data } ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
2022-11-03 19:21:32 +01:00
expect ( css ) . toBe ( 'OK' )
2022-09-22 00:10:24 +02:00
expect ( fetch ) . toHaveBeenCalledTimes ( 1 )
expect ( fetch ) . toHaveBeenCalledWith ( url , expect . any ( Object ) )
} )
} )
describe ( 'Errors' , ( ) = > {
test ( 'Missing function name' , async ( ) = > {
await expect (
loader ( {
functionName : '' , // default import
data : [ ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot (
2023-02-16 15:33:39 +01:00
` "next/font/google has no default export" `
2022-09-22 00:10:24 +02:00
)
} )
test ( 'Unknown font' , async ( ) = > {
await expect (
loader ( {
functionName : 'Unknown_Font' ,
data : [ ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot (
2023-01-09 19:15:45 +01:00
` "Unknown font \` Unknown Font \` " `
2022-09-22 00:10:24 +02:00
)
} )
2022-10-20 19:42:19 +02:00
test ( 'Unknown weight' , async ( ) = > {
2022-09-22 00:10:24 +02:00
await expect (
loader ( {
functionName : 'Inter' ,
2022-10-20 19:42:19 +02:00
data : [ { weight : '123' } ] ,
2022-09-22 00:10:24 +02:00
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot ( `
2022-10-20 19:42:19 +02:00
" Unknown weight \ ` 123 \` for font \` Inter \` .
Available weights : \ ` 100 \` , \` 200 \` , \` 300 \` , \` 400 \` , \` 500 \` , \` 600 \` , \` 700 \` , \` 800 \` , \` 900 \` , \` variable \` "
` )
2022-09-22 00:10:24 +02:00
} )
2022-10-20 19:42:19 +02:00
test ( 'Missing weight for non variable font' , async ( ) = > {
2022-09-22 00:10:24 +02:00
await expect (
loader ( {
functionName : 'Abel' ,
data : [ ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot ( `
2022-10-20 19:42:19 +02:00
" Missing weight for font \ ` Abel \` .
Available weights : \ ` 400 \` "
` )
} )
test ( 'Unknown style' , async ( ) = > {
await expect (
loader ( {
functionName : 'Molle' ,
data : [ { weight : '400' , style : 'normal' } ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-10-20 19:42:19 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot ( `
" Unknown style \ ` normal \` for font \` Molle \` .
Available styles : \ ` italic \` "
2022-09-22 00:10:24 +02:00
` )
} )
test ( 'Invalid display value' , async ( ) = > {
await expect (
loader ( {
functionName : 'Inter' ,
data : [ { display : 'invalid' } ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot ( `
" Invalid display value \ ` invalid \` for font \` Inter \` .
Available display values : \ ` auto \` , \` block \` , \` swap \` , \` fallback \` , \` optional \` "
` )
} )
test ( 'Setting axes on non variable font' , async ( ) = > {
await expect (
loader ( {
functionName : 'Abel' ,
2022-10-20 19:42:19 +02:00
data : [ { weight : '400' , axes : [ ] } ] ,
2022-09-22 00:10:24 +02:00
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot (
` "Axes can only be defined for variable fonts" `
)
} )
test ( 'Setting axes on font without definable axes' , async ( ) = > {
await expect (
loader ( {
functionName : 'Lora' ,
data : [ { axes : [ ] } ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot (
` "Font \` Lora \` has no definable \` axes \` " `
)
} )
test ( 'Invalid axes value' , async ( ) = > {
await expect (
loader ( {
functionName : 'Inter' ,
data : [ { axes : true } ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot ( `
" Invalid axes value for font \ ` Inter \` , expected an array of axes.
Available axes : \ ` slnt \` "
` )
} )
test ( 'Invalid value in axes array' , async ( ) = > {
await expect (
loader ( {
functionName : 'Roboto_Flex' ,
data : [ { axes : [ 'INVALID' ] } ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
2022-09-22 21:49:02 +02:00
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-24 07:21:38 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-09-22 00:10:24 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot ( `
" Invalid axes value \ ` INVALID \` for font \` Roboto Flex \` .
Available axes : \ ` GRAD \` , \` XTRA \` , \` YOPQ \` , \` YTAS \` , \` YTDE \` , \` YTFI \` , \` YTLC \` , \` YTUC \` , \` opsz \` , \` slnt \` , \` wdth \` "
` )
} )
2022-10-28 00:25:57 +02:00
test ( 'Variable in weight array' , async ( ) = > {
await expect (
loader ( {
functionName : 'Inter' ,
data : [ { weight : [ '100' , 'variable' ] } ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-10-28 00:25:57 +02:00
isServer : true ,
2022-11-02 21:38:25 +01:00
variableName : 'myFont' ,
2022-10-28 00:25:57 +02:00
} )
) . rejects . toThrowErrorMatchingInlineSnapshot (
` "Unexpected \` variable \` in weight array for font \` Inter \` . You only need \` variable \` , it includes all available weights." `
)
} )
Update subset validation in @next/font/google and fix CJK bug (#44594)
Currently there's a bug when selecting Chinese, Japanese or Korean (CJK)
as subsets.
```js
const notoSans = Noto_Sans_JP({
subsets: ['japanese'],
})
```
It actually doesn't work, nothing preloads. This PR solves this by
removing CJK languages as candidates for preloading. The reason is that
they contain so many glyphs that each font-family is split up in 100+
font files. It doesn't make sense to preload all of them.
So CJK users will have to disable preloading.
```js
const notoSansJapanese = Noto_Sans_JP({
weight: '400',
preload: false,
})
```
In case you do manually disable preloading like above, the default
`font-display` is changed to `swap`.
This PR also improves the validation errors of subsets.
1. Providing unknown subset
```
`@next/font` error:
Unknown subset `japanese` for font `Inter`.
Available subsets: `cyrillic`, `cyrillic-ext`, `greek`, `greek-ext`, `latin`, `latin-ext`, `vietnamese`
```
2. Missing specified subset. The error has a link with further
instructions.
```
`@next/font` error:
Missing selected subsets for font `Inter`. Please specify subsets in the function call or in your `next.config.js`. Read more: https://nextjs.org/docs/messages/google-fonts-missing-subsets
```
fixes NEXT-336
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
## Feature
- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
## Documentation / Examples
- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-01-06 00:51:38 +01:00
test ( 'Invalid subset in call' , async ( ) = > {
await expect (
loader ( {
functionName : 'Inter' ,
data : [ { weight : [ '100' , 'variable' ] , subsets : [ 'latin' , 'oops' ] } ] ,
config : { subsets : [ 'ignored' ] } ,
emitFontFile : jest.fn ( ) ,
resolve : jest.fn ( ) ,
loaderContext : { } as any ,
isDev : false ,
isServer : true ,
variableName : 'myFont' ,
} )
) . rejects . toThrowErrorMatchingInlineSnapshot ( `
" Unknown subset \ ` oops \` for font \` Inter \` .
Available subsets : \ ` cyrillic \` , \` cyrillic-ext \` , \` greek \` , \` greek-ext \` , \` latin \` , \` latin-ext \` , \` vietnamese \` "
` )
} )
test ( 'Invalid subset in config' , async ( ) = > {
await expect (
loader ( {
functionName : 'Inter' ,
data : [ { weight : [ '100' , 'variable' ] } ] ,
config : { subsets : [ 'whoops' ] } ,
emitFontFile : jest.fn ( ) ,
resolve : jest.fn ( ) ,
loaderContext : { } as any ,
isDev : false ,
isServer : true ,
variableName : 'myFont' ,
} )
) . rejects . toThrowErrorMatchingInlineSnapshot ( `
" Unknown subset \ ` whoops \` for font \` Inter \` .
Available subsets : \ ` cyrillic \` , \` cyrillic-ext \` , \` greek \` , \` greek-ext \` , \` latin \` , \` latin-ext \` , \` vietnamese \` "
` )
} )
test ( 'Missing subsets in config and call' , async ( ) = > {
await expect (
loader ( {
functionName : 'Inter' ,
data : [ { weight : [ '100' , 'variable' ] } ] ,
config : { } ,
emitFontFile : jest.fn ( ) ,
resolve : jest.fn ( ) ,
loaderContext : { } as any ,
isDev : false ,
isServer : true ,
variableName : 'myFont' ,
} )
) . rejects . toThrowErrorMatchingInlineSnapshot (
` "Missing selected subsets for font \` Inter \` . Please specify subsets in the function call or in your \` next.config.js \` . Read more: https://nextjs.org/docs/messages/google-fonts-missing-subsets" `
)
} )
2022-09-22 00:10:24 +02:00
} )
2022-11-04 19:47:42 +01:00
it ( 'should not send duplicate requests when several font variants use the same font file' , async ( ) = > {
fetch
. mockResolvedValue ( {
ok : true ,
arrayBuffer : ( ) = > '' ,
} )
. mockResolvedValueOnce ( {
ok : true ,
text : async ( ) = > `
/* latin */
@font - face {
font - family : 'Fraunces' ;
font - style : normal ;
font - weight : 100 ;
font - display : swap ;
src : url ( https : //fonts.gstatic.com/s/fraunces/v24/6NUu8FyLNQOQZAnv9bYEvDiIdE9Ea92uemAk_WBq8U_9v0c2Wa0K7iN7hzFUPJH58nib14c7qv8oRcTn.woff2) format('woff2');
unicode - range : U + 0000 - 00 FF , U + 0131 , U + 0152 - 0153 , U + 02 BB - 02 BC , U + 02 C6 , U + 02 DA , U + 02 DC , U + 2000 - 206 F , U + 2074 , U + 20 AC , U + 2122 , U + 2191 , U + 2193 , U + 2212 , U + 2215 , U + FEFF , U + FFFD ;
}
/* latin */
@font - face {
font - family : 'Fraunces' ;
font - style : normal ;
font - weight : 300 ;
font - display : swap ;
src : url ( https : //fonts.gstatic.com/s/fraunces/v24/6NUu8FyLNQOQZAnv9bYEvDiIdE9Ea92uemAk_WBq8U_9v0c2Wa0K7iN7hzFUPJH58nib14c7qv8oRcTn.woff2) format('woff2');
unicode - range : U + 0000 - 00 FF , U + 0131 , U + 0152 - 0153 , U + 02 BB - 02 BC , U + 02 C6 , U + 02 DA , U + 02 DC , U + 2000 - 206 F , U + 2074 , U + 20 AC , U + 2122 , U + 2191 , U + 2193 , U + 2212 , U + 2215 , U + FEFF , U + FFFD ;
}
/* latin */
@font - face {
font - family : 'Fraunces' ;
font - style : normal ;
font - weight : 900 ;
font - display : swap ;
src : url ( https : //fonts.gstatic.com/s/fraunces/v24/6NUu8FyLNQOQZAnv9bYEvDiIdE9Ea92uemAk_WBq8U_9v0c2Wa0K7iN7hzFUPJH58nib14c7qv8oRcTn.woff2) format('woff2');
unicode - range : U + 0000 - 00 FF , U + 0131 , U + 0152 - 0153 , U + 02 BB - 02 BC , U + 02 C6 , U + 02 DA , U + 02 DC , U + 2000 - 206 F , U + 2074 , U + 20 AC , U + 2122 , U + 2191 , U + 2193 , U + 2212 , U + 2215 , U + FEFF , U + FFFD ;
}
` ,
} )
const { css } = await loader ( {
functionName : 'Fraunces' ,
data : [ { weight : [ '100' , '300' , '900' ] } ] ,
config : { subsets : [ ] } ,
emitFontFile : jest.fn ( ) ,
resolve : jest.fn ( ) ,
2022-11-08 20:05:54 +01:00
loaderContext : { } as any ,
isDev : false ,
2022-11-04 19:47:42 +01:00
isServer : true ,
variableName : 'myFont' ,
} )
expect ( fetch ) . toHaveBeenCalledTimes ( 2 )
expect ( css ) . not . toInclude ( 'https://fonts.gstatic.com/s/fraunces/v24/' )
} )
2022-09-22 00:10:24 +02:00
} )