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+/=]+$/) }) })