mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-07 23:03:51 +08:00
feat: 优化档案搜索与头像
新增退群监控开关 发送限速
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { Contact } from '../../src/shared/types'
|
||||
import { filterContacts } from '../../src/renderer/src/utils/contact-search'
|
||||
|
||||
const contact: Contact = {
|
||||
m_nsUsrName: 'wxid_XxYyZz',
|
||||
m_nsNickName: '小号',
|
||||
md5: 'fixture',
|
||||
type: 'user',
|
||||
remark: '工作手机',
|
||||
wechatNickname: 'Shinven',
|
||||
alias: 'abc123',
|
||||
wechatId: 'wechat_abc123'
|
||||
}
|
||||
|
||||
describe('filterContacts', () => {
|
||||
it.each(['Shinven', '小号', '工作', 'abc123', 'WECHAT_ABC', 'WXID_xxy']) (
|
||||
'matches all contact identity fields with %s',
|
||||
(query) => {
|
||||
expect(filterContacts([contact], ` ${query} `)).toEqual([contact])
|
||||
}
|
||||
)
|
||||
|
||||
it('returns the original list for a blank query and excludes unrelated contacts', () => {
|
||||
const list = [contact]
|
||||
expect(filterContacts(list, ' ')).toBe(list)
|
||||
expect(filterContacts(list, 'not-found')).toEqual([])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user