1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-13 14:18:05 +09:00
elk/tests/unit/language.test.ts
Anthony Fu 04404e0c0b
chore: upgrade to Nuxt 3.1 (#1455)
Co-authored-by: Daniel Roe <daniel@roe.dev>
2023-01-31 04:07:17 +01:00

19 lines
942 B
TypeScript

import { describe, expect, it } from 'vitest'
import { matchLanguages } from '../../utils/language'
describe('language', () => {
it('match language', () => {
expect(matchLanguages(['zh-CN', 'zh-TW'], ['zh'])).toMatchInlineSnapshot('"zh-CN"')
expect(matchLanguages(['zh-CN', 'zh-TW'], ['en'])).toMatchInlineSnapshot('null')
expect(matchLanguages(['zh-CN', 'zh-TW', 'en-US'], ['zh', 'en'])).toMatchInlineSnapshot('"zh-CN"')
expect(matchLanguages(['zh-CN', 'zh-TW', 'en-US'], ['en', 'zh-CN'])).toMatchInlineSnapshot('"en-US"')
expect(matchLanguages(['zh-CN', 'zh-TW', 'en-US'], ['zh-TW', 'en'])).toMatchInlineSnapshot('"zh-TW"')
expect(matchLanguages(['zh-TW', 'en-US'], ['zh-CN', 'en-GB'])).toMatchInlineSnapshot('"zh-TW"')
expect(matchLanguages(['zh-TW', 'en-GB'], ['ja-JP', 'zh-CN'])).toMatchInlineSnapshot('"zh-TW"')
expect(matchLanguages(['zh-TW'], ['zh-tw'])).toMatchInlineSnapshot('"zh-TW"')
})
})