1
import { test } from 'vitest';
3
test('placeholder', () => {});
4
// describe('filterWithKeywords', () => {
5
// const data: Record<string, BaseDataModel> = {
9
// title: 'hello world',
10
// description: 'test case',
18
// description: 'hello world',
24
// it('should return an empty object if map is empty', () => {
25
// const result = filterWithKeywords({}, 'hello');
26
// expect(result).toEqual({});
29
// it('should return the original map if keywords is empty', () => {
30
// const result = filterWithKeywords(data, '');
31
// expect(result).toEqual(data);
34
// it('should return a filtered map if keywords is not empty', () => {
35
// const result = filterWithKeywords(data, 'world');
36
// expect(result).toEqual({
40
// title: 'hello world',
41
// description: 'test case',
49
// description: 'hello world',
56
// it('should only consider title, description and tag properties if extraSearchStr is not provided', () => {
57
// const result = filterWithKeywords(data, 'test');
58
// expect(result).toEqual({
62
// title: 'hello world',
63
// description: 'test case',
70
// it('should consider extraSearchStr in addition to title, description and tag properties if provided', () => {
71
// const extraSearchStr = (item: BaseDataModel) => {
72
// return item.meta.avatar || '';
74
// const data: Record<string, BaseDataModel> = {
78
// title: 'hello world',
79
// description: 'test case',
88
// description: 'hello world',
95
// const result = filterWithKeywords(data, 'yyy', extraSearchStr);
96
// expect(result).toEqual({
101
// description: 'hello world',
109
// it('should ensure that each filtered object has at least one property that includes the keyword or extraSearchStr', () => {
110
// const result = filterWithKeywords(data, 't');
111
// expect(result).toEqual({
115
// title: 'hello world',
116
// description: 'test case',