File size: 985 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { getFontAxes } from './get-font-axes'

describe('getFontAxes errors', () => {
  test('Setting axes on font without definable axes', () => {
    expect(() =>
      getFontAxes('Lora', ['variable'], [], [])
    ).toThrowErrorMatchingInlineSnapshot(
      `"Font \`Lora\` has no definable \`axes\`"`
    )
  })

  test('Invalid axes value', async () => {
    expect(() => getFontAxes('Inter', ['variable'], [], true as any))
      .toThrowErrorMatchingInlineSnapshot(`
      "Invalid axes value for font \`Inter\`, expected an array of axes.
      Available axes: \`opsz\`"
    `)
  })

  test('Invalid value in axes array', async () => {
    expect(() => getFontAxes('Roboto Flex', ['variable'], [], ['INVALID']))
      .toThrowErrorMatchingInlineSnapshot(`
      "Invalid axes value \`INVALID\` for font \`Roboto Flex\`.
      Available axes: \`GRAD\`, \`XOPQ\`, \`XTRA\`, \`YOPQ\`, \`YTAS\`, \`YTDE\`, \`YTFI\`, \`YTLC\`, \`YTUC\`, \`opsz\`, \`slnt\`, \`wdth\`"
    `)
  })
})