File size: 891 Bytes
e445b51
 
 
 
 
 
b1cfe1b
 
 
 
 
e445b51
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { formatBatchPromptHistory, readBatchPromptLines } from './batch-prompts';
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';

describe('readBatchPromptLines', () => {
    it('keeps non-empty prompts in user order', () => {
        assert.deepEqual(readBatchPromptLines('  午后咖啡馆窗边  \n\n奶油色卧室一角\r\n  周末花店门口  '), [
            '午后咖啡馆窗边',
            '奶油色卧室一角',
            '周末花店门口'
        ]);
    });

    it('does not invent prompts from empty lines', () => {
        assert.deepEqual(readBatchPromptLines('\n  \r\n'), []);
    });
});

describe('formatBatchPromptHistory', () => {
    it('stores batch prompts as a readable multiline history prompt', () => {
        assert.equal(formatBatchPromptHistory(['第一张', '第二张']), '第一张\n第二张');
    });
});