Files
pinyin-pro/test/double-unicode.test.js
2024-06-09 06:56:20 +08:00

38 lines
1.1 KiB
JavaScript

import { pinyin } from '../lib/index';
import { expect, describe, it } from 'vitest';
describe('double unicode', () => {
it('[double unicode]base', () => {
const result1 = pinyin('𧒽');
expect(result1).to.be.equal('𧒽');
});
it('[double unicode]with pinyin', () => {
const result2 = pinyin('𧒽测试');
expect(result2).to.be.equal('𧒽 cè shì');
});
it('[double unicode]dpdp', () => {
const result3 = pinyin('𧒽测试𧒽测试', {});
expect(result3).to.be.equal('𧒽 cè shì 𧒽 cè shì');
});
it('[double unicode]dp consecutive', () => {
const result4 = pinyin('𧒽测试', { nonZh: 'consecutive' });
expect(result4).to.be.equal('𧒽 cè shì');
});
it('[double unicode]dpdpdp consecutive', () => {
const result5 = pinyin('测试a𧒽𧒽a测试a𧒽𧒽a测试', {
nonZh: 'consecutive',
});
expect(result5).to.be.equal('cè shì a𧒽𧒽a cè shì a𧒽𧒽a cè shì');
});
it('[double unicode]dp consecutive', () => {
const result4 = pinyin('测试𬭬𬭬测试𬭬测试');
expect(result4).to.be.equal('cè shì huì huì cè shì huì cè shì');
});
});