mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-04 19:43:43 +08:00
refactor: 重构一下档案搜索功能 支持拼音微信号等
This commit is contained in:
@@ -14,7 +14,7 @@ const contact: Contact = {
|
||||
}
|
||||
|
||||
describe('filterContacts', () => {
|
||||
it.each(['Shinven', '小号', '工作', 'abc123', 'WECHAT_ABC', 'WXID_xxy']) (
|
||||
it.each(['Shinven', '小号', '工作', 'gongzuoshouji', 'gzsj', 'abc123', 'WECHAT_ABC', 'WXID_xxy'])(
|
||||
'matches all contact identity fields with %s',
|
||||
(query) => {
|
||||
expect(filterContacts([contact], ` ${query} `)).toEqual([contact])
|
||||
@@ -26,4 +26,18 @@ describe('filterContacts', () => {
|
||||
expect(filterContacts(list, ' ')).toBe(list)
|
||||
expect(filterContacts(list, 'not-found')).toEqual([])
|
||||
})
|
||||
|
||||
it('matches pinyin when the Chinese name is stored in m_nsNickName', () => {
|
||||
const list = [{ ...contact, remark: '', wechatNickname: '' }]
|
||||
|
||||
expect(filterContacts(list, 'xiaohao')).toEqual(list)
|
||||
expect(filterContacts(list, 'xh')).toEqual(list)
|
||||
})
|
||||
|
||||
it('matches pinyin for a dedicated Chinese remark', () => {
|
||||
const list = [{ ...contact, m_nsNickName: 'Shinven', remark: '小号' }]
|
||||
|
||||
expect(filterContacts(list, 'xiaohao')).toEqual(list)
|
||||
expect(filterContacts(list, 'xh')).toEqual(list)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user