chat-flow/__tests__/step-detail.test.ts

39 lines
1.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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");
});
});