Files
SubTracker/apps/web/tests/unit/utils/wallos-import.test.ts
SmileQWQ ca78052a0b feat: add web i18n with shared messages
- add vue-i18n to the web app and load zh-CN and en-US strings from the shared message catalog

- replace hardcoded UI copy across login, subscriptions, settings, calendar, statistics and supporting dialogs and utilities with translation keys

- send locale headers with API requests, reuse localized message helpers and cover the localized web flows with regression tests
2026-05-17 20:51:20 +08:00

20 lines
832 B
TypeScript

import { describe, expect, it } from 'vitest'
import { setAppLocale } from '@/locales'
import { getJsonImportWarningMessage, shouldRecommendDbImport } from '../../../src/utils/wallos-import'
describe('wallos import ui helpers', () => {
it('recommends db import for json file selection or json preview type', () => {
expect(shouldRecommendDbImport('subscriptions.json')).toBe(true)
expect(shouldRecommendDbImport('wallos.db')).toBe(false)
expect(shouldRecommendDbImport(null, 'json')).toBe(true)
expect(shouldRecommendDbImport('subscriptions.zip', 'db')).toBe(false)
})
it('provides a stable warning message', () => {
setAppLocale('zh-CN')
const message = getJsonImportWarningMessage()
expect(message).toContain('推荐优先使用 Wallos DB 导入')
expect(message).toContain('JSON')
})
})