刘光辉
3 小时以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import dayjs from 'dayjs';
 
import { afterEach, describe, expect, it } from 'vitest';
 
import { loadDayjsLocale } from '../index';
 
describe('loadDayjsLocale', () => {
  afterEach(() => dayjs.locale('en'));
 
  it.each([
    ['en-US', 'en'],
    ['zh-CN', 'zh-cn'],
    ['zh-TW', 'zh-tw'],
  ] as const)('switches %s to the matching dayjs locale', async (language, expected) => {
    await loadDayjsLocale(language);
 
    expect(dayjs.locale()).toBe(expected);
  });
});