-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathindex.test.js
More file actions
29 lines (24 loc) · 761 Bytes
/
index.test.js
File metadata and controls
29 lines (24 loc) · 761 Bytes
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
const { test } = require('node:test')
const assert = require('node:assert')
const { glob } = require('node:fs')
const langFiles = require('./index')
glob('*.lang', (err, matches) => {
if (err) {
console.error(err)
return
}
const localeCount = matches.length
test(`should contain ${localeCount} languages`, () => {
assert.equal(Object.keys(langFiles).length, localeCount)
})
test('should contain specific languages', () => {
/**
* Array of expected locales extracted from the matches array.
* @type {string[]}
*/
const expectedLocales = matches.map((lang) => lang.substring(0, lang.indexOf('.')))
for (const lang of expectedLocales) {
assert.equal(Object.hasOwn(langFiles, lang), true)
}
})
})