Files
opsxshell/test/utils/textBase64.test.ts
T
Logan.Li b0d0e3a5f3 feat(i18n): add multi-language support (ja/ko/vi/ru/zh-TW) with system auto-detection
- Extend AppLanguage to 7 locales: zh-CN, zh-TW, en, ja, ko, vi, ru
- Auto-detect system language via navigator.languages; fallback to English
- Add BCP47 locale mapping for date formatting and sorting
- Create 50 translation JSON files (5 languages × 10 namespaces, 1137 keys each)
- Update language selector with native language names
- Extend locale key parity test to cover all 7 languages (70 assertions)
- Add VNC/RDP desktop, serial terminal, AI agent, port forwarding, and SFTP features
- Add credential encryption, host metrics, session backup crypto, and zmodem bridge
- Update Rust backend: desktop services, host metrics, SSH/SFTP enhancements
2026-08-12 00:07:48 +08:00

16 lines
568 B
TypeScript

import { describe, expect, it } from 'vitest'
import { decodeBase64ToText, encodeTextToBase64 } from '../../src/utils/textBase64'
describe('textBase64', () => {
it('round-trips UTF-8 including CJK', () => {
const sample = '{"name":"运维主机","host":"ops.example.com"}'
expect(decodeBase64ToText(encodeTextToBase64(sample))).toBe(sample)
})
it('produces standard base64 without raw JSON', () => {
const encoded = encodeTextToBase64('{"version":1}')
expect(encoded).not.toContain('{')
expect(encoded).toMatch(/^[A-Za-z0-9+/=]+$/)
})
})