Skip to content

Commit 57b5eca

Browse files
committed
test: add stub lookupFontURL function
1 parent 78138b2 commit 57b5eca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/parse.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ describe('error handling', () => {
111111
it('handles no font details supplied', async () => {
112112
const plugin = FontFamilyInjectionPlugin({
113113
dev: true,
114+
lookupFontURL: () => undefined,
114115
resolveFontFace: () => ({ fonts: [] })
115116
}).raw({}, { framework: 'vite' }) as any
116117
expect(await plugin.transform(`:root { font-family: 'Poppins', 'Arial', sans-serif }`).then((r: any) => r?.code)).toMatchInlineSnapshot(`undefined`)
@@ -121,6 +122,7 @@ const slugify = (str: string) => str.toLowerCase().replace(/[^\d\w]/g, '-')
121122
async function transform (css: string) {
122123
const plugin = FontFamilyInjectionPlugin({
123124
dev: true,
125+
lookupFontURL: () => undefined,
124126
resolveFontFace: (family, options) => ({
125127
fonts: [{ src: [{ url: `/${slugify(family)}.woff2`, format: 'woff2' }] }],
126128
fallbacks: options?.fallbacks ? ['Times New Roman', ...options.fallbacks] : undefined

0 commit comments

Comments
 (0)