diff --git a/test/i18n-packs.test.js b/test/i18n-packs.test.js index 7ea69335..9b8182e8 100644 --- a/test/i18n-packs.test.js +++ b/test/i18n-packs.test.js @@ -16,6 +16,7 @@ import path from 'node:path'; import { spawnSync } from 'node:child_process'; import http from 'node:http'; import { fileURLToPath } from 'node:url'; +import { APP_VERSION } from '../shared/constants.js'; import { t, tc, tParts, setLang, getLang, addMessages, setMessages, setI18nWarn, registerLangs, getLangs, langChain, langInfo, normalizeLang, checkTranslation, parsePluralForms, pluralCategory, format, @@ -417,7 +418,7 @@ test('tools: template writes a skeleton (or adds the missing msgids to a pack), const used = new Map([['开始', { where: 'a.js:1', params: [] }], ['还剩 {n} 秒', { where: 'b.js:2', params: new Set(['n']) }], ['{n} 名', { where: 'c.js:3', params: new Set(['n', 'count']) }], ['表里的', { where: 'd.js:4', params: null }]]); const skel = packTemplate('qaa', { msgids: [...used.keys()] }); assert.deepEqual(Object.keys(skel.json), ['_meta', '开始', '还剩 {n} 秒', '{n} 名', '表里的']); - assert.deepEqual([skel.json._meta.type, skel.json._meta.lang, skel.json._meta.fallback, skel.json._meta.app], ['lang', 'qaa', ['en'], '>=0.2.0']); + assert.deepEqual([skel.json._meta.type, skel.json._meta.lang, skel.json._meta.fallback, skel.json._meta.app], ['lang', 'qaa', ['en'], `>=${APP_VERSION.replace(/-.*$/, '')}`], 'this release and later (tools/i18n.mjs appRange)'); assert.equal(packTemplate('zh-TW', { msgids: [] }).json._meta.fallback.length, 0, 'a Chinese variant falls back to the Chinese msgid'); assert.equal(skel.json['开始'], ''); const again = packTemplate('qaa', { existing: { _meta: { name: 'Mine' }, 开始: 'Los', 旧的: 'alt' }, msgids: [...used.keys()], fill: { 还剩: 'x' } });