| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,27 @@ | |||
| 1 | + import type { Provider } from '../src' | ||
| 2 | + import { describe, expect, it } from 'vitest' | ||
| 3 | + import { createUnifont, providers } from '../src' | ||
| 4 | + | ||
| 5 | + // `adobe` needs a project id, and `npm` cannot enumerate the registry, so neither can be | ||
| 6 | + // exercised without credentials or a guessed package name. | ||
| 7 | + const cases: { provider: Provider, family: string }[] = [ | ||
| 8 | + { provider: providers.google(), family: 'Newsreader' }, | ||
| 9 | + { provider: providers.googleicons(), family: 'Material Symbols Outlined' }, | ||
| 10 | + { provider: providers.bunny(), family: 'Poppins' }, | ||
| 11 | + { provider: providers.fontsource(), family: 'Roboto' }, | ||
| 12 | + { provider: providers.fontshare(), family: 'Satoshi' }, | ||
| 13 | + ] | ||
| 14 | + | ||
| 15 | + describe('getFontProperties round-trip', () => { | ||
| 16 | + for (const { provider, family } of cases) { | ||
| 17 | + it(`resolves the properties reported by ${provider._name}`, async () => { | ||
| 18 | + const unifont = await createUnifont([provider], { throwOnError: true }) | ||
| 19 | + | ||
| 20 | + const properties = await unifont.getFontProperties(family) | ||
| 21 | + expect(properties).toBeDefined() | ||
| 22 | + | ||
| 23 | + const { fonts } = await unifont.resolveFont(family, properties!) | ||
| 24 | + expect(fonts.length).toBeGreaterThan(0) | ||
| 25 | + }) | ||
| 26 | + } | ||
| 27 | + }) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments