mirror of
https://github.com/zh-lx/pinyin-pro.git
synced 2026-03-13 09:51:38 +08:00
24 lines
658 B
JavaScript
24 lines
658 B
JavaScript
import { pinyin, addDict, removeDict } from '../lib/index';
|
|
import { expect, describe, it } from 'vitest';
|
|
|
|
describe("addDict", () => {
|
|
it("[addDict]string dict", () => {
|
|
const stringDict = {
|
|
汉语拼音: 'hàn yǔ pīn yīn'
|
|
}
|
|
addDict(stringDict);
|
|
const result = pinyin("汉语拼音");
|
|
expect(result).to.be.equal("hàn yǔ pīn yīn");
|
|
});
|
|
|
|
it("[addDict]array dict", () => {
|
|
const stringDict = {
|
|
汉语拼音: ['hàn yǔ pīn yīn']
|
|
}
|
|
addDict(stringDict, "arrayDict");
|
|
removeDict('arrayDict');
|
|
const result = pinyin("汉语拼音");
|
|
expect(result).to.be.equal("hàn yǔ pīn yīn");
|
|
});
|
|
});
|