-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstandard-locales.test.ts
More file actions
41 lines (32 loc) · 1 KB
/
standard-locales.test.ts
File metadata and controls
41 lines (32 loc) · 1 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
import { describe, expect, it } from 'vitest'
import { languages } from './languages.ts'
import { regions } from './regions.ts'
import { scripts } from './scripts.ts'
import { standardLocales } from './standard-locales.ts'
describe('standard-locales', () => {
it('all languages are part of our central list', () => {
expect.assertions(219)
for (const tag of standardLocales) {
const locale = new Intl.Locale(tag)
expect(languages).toContain(locale.language)
}
})
it('all scripts are part of our central list', () => {
expect.assertions(15)
for (const tag of standardLocales) {
const locale = new Intl.Locale(tag)
if (locale.script) {
expect(scripts).toContain(locale.script)
}
}
})
it('all regions are part of our central list', () => {
expect.assertions(216)
for (const tag of standardLocales) {
const locale = new Intl.Locale(tag)
if (locale.region) {
expect(regions).toContain(locale.region)
}
}
})
})