Files
Ydisks-Xianyu-Helper/frontend/components/cardListState.test.ts
T
Christ d77c317452 feat: 对齐闲鱼续期流程并完善业务管理
对齐官方 WebSocket 批量握手、注册、心跳、ACK、同步恢复及运行时设备标识生命周期。

保留 Cookie 完整属性,接入静默续期和保存登录信息设置,并在凭证更新后重建账号连接。

完善订单与商品同步、卡券和通知渠道交互,更新前端品牌、时间展示及嵌入资源。

补充 Go 与前端回归测试,确保完整检查和生产构建通过。
2026-07-22 12:51:52 +08:00

20 lines
678 B
TypeScript

import { describe, expect, test } from 'vitest';
import type { Card } from '../types';
import { filterCards } from './cardListState';
const cards = [
{ id: 1, name: '年终总结 PPT', type: 'text' },
{ id: 2, name: '年终总结兑换码', type: 'data' },
{ id: 3, name: '产品介绍 PPT', type: 'text' },
] as Card[];
describe('filterCards', () => {
test('combines type and name filters with AND semantics', () => {
expect(filterCards(cards, 'text', '年终')).toEqual([cards[0]]);
});
test('matches names case-insensitively and ignores surrounding whitespace', () => {
expect(filterCards(cards, '', ' ppt ')).toEqual([cards[0], cards[2]]);
});
});