forked from memochou1993/gpt-ai-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontinue.test.js
35 lines (32 loc) · 830 Bytes
/
continue.test.js
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
import {
afterEach, beforeEach, expect, test,
} from '@jest/globals';
import { getPrompt, handleEvents, removePrompt } from '../app/index.js';
import { COMMAND_BOT_CONTINUE } from '../app/commands/index.js';
import {
createEvents, TIMEOUT, MOCK_USER_01, MOCK_TEXT_OK,
} from './utils.js';
beforeEach(() => {
//
});
afterEach(() => {
removePrompt(MOCK_USER_01);
});
test('COMMAND_BOT_CONTINUE', async () => {
const events = [
...createEvents([COMMAND_BOT_CONTINUE.text]),
];
let results;
try {
results = await handleEvents(events);
} catch (err) {
console.error(err);
}
expect(getPrompt(MOCK_USER_01).sentences.length).toEqual(1);
const replies = results.map(({ messages }) => messages.map(({ text }) => text));
expect(replies).toEqual(
[
[MOCK_TEXT_OK],
],
);
}, TIMEOUT);