forked from prompt-engineering/chat-flow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep-detail.test.ts
38 lines (36 loc) · 1.23 KB
/
step-detail.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
import "@testing-library/jest-dom";
import { fillStepWithValued } from "@/flows/types/flow-step";
describe("Step Valued", () => {
it("fillStepWithValued", () => {
let step = {
name: "分析需求,编写用户故事",
ask: "story: $$placeholder$$",
cachedResponseRegex: "/.*/",
values: {
placeholder: "用户通过主菜单进入“权限管理”模块,选择“账号管理”Tab页,可以看到“新增账号”按钮。",
},
preActions: [],
postActions: [],
};
const result = fillStepWithValued(step, {});
expect(result.replaced).toEqual(true);
expect(result.ask).toEqual(
"story: 用户通过主菜单进入“权限管理”模块,选择“账号管理”Tab页,可以看到“新增账号”按钮。",
);
});
it("fillStepWithValued with cached", () => {
const step = {
name: "分析需求,编写用户故事",
ask: "story: $$response:1$$",
cachedResponseRegex: "/.*/",
values: {},
preActions: [],
postActions: [],
};
const result = fillStepWithValued(step, {
1: "Cached Value",
});
expect(result.replaced).toEqual(true);
expect(result.ask).toEqual("story: Cached Value");
});
});