forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmerge.test.ts
48 lines (44 loc) · 1.39 KB
/
merge.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { expect } from 'vitest';
import { AIChatModelCard } from '@/types/aiModel';
import { mergeArrayById } from './merge';
describe('mergeArrayById', () => {
it('should merge data', () => {
const data = mergeArrayById(
[
{
contextWindowTokens: 128_000,
description:
'o1-mini是一款针对编程、数学和科学应用场景而设计的快速、经济高效的推理模型。该模型具有128K上下文和2023年10月的知识截止日期。',
displayName: 'OpenAI o1-mini',
enabled: true,
id: 'o1-mini',
maxOutput: 65_536,
pricing: {
input: 3,
output: 12,
},
releasedAt: '2024-09-12',
type: 'chat',
},
],
[{ id: 'o1-mini', displayName: 'OpenAI o1-mini ABC', type: 'chat' }],
);
expect(data).toEqual([
{
contextWindowTokens: 128_000,
description:
'o1-mini是一款针对编程、数学和科学应用场景而设计的快速、经济高效的推理模型。该模型具有128K上下文和2023年10月的知识截止日期。',
displayName: 'OpenAI o1-mini ABC',
enabled: true,
id: 'o1-mini',
maxOutput: 65_536,
pricing: {
input: 3,
output: 12,
},
releasedAt: '2024-09-12',
type: 'chat',
},
]);
});
});