Socialify

Folder ..

Viewing font.test.ts
23 lines (20 loc) • 569.0 B

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
 * @jest-environment node
 */

import { SatoriOptions } from 'satori'
import { getFont } from './renderCard'
import { Font } from './types/configType'

describe('Verify Fonts', () => {
  for (const item in Font) {
    const fontName = Font[item as keyof typeof Font]

    for (const weight of [200, 400, 500]) {
      test(`Check font '${fontName}', ${weight} exists`, async () => {
        const { data } = await getFont(
          fontName,
          weight as SatoriOptions['fonts'][0]['weight']
        )
        expect(data).toBeTruthy()
      })
    }
  }
})