mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 19:14:44 +00:00
test: tighten slack progress block assertions
This commit is contained in:
@@ -11,6 +11,16 @@ function progressLine(index: number) {
|
||||
};
|
||||
}
|
||||
|
||||
function expectProgressBlock(block: unknown, label: string, detail: string) {
|
||||
expect(block).toEqual({
|
||||
type: "section",
|
||||
fields: [
|
||||
{ type: "mrkdwn", text: `🛠️ *${label}*` },
|
||||
{ type: "mrkdwn", text: detail },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
describe("buildSlackProgressDraftBlocks", () => {
|
||||
it("renders structured progress lines as compact Block Kit fields", () => {
|
||||
expect(
|
||||
@@ -70,26 +80,14 @@ describe("buildSlackProgressDraftBlocks", () => {
|
||||
lines: Array.from({ length: 60 }, (_value, index) => progressLine(index)),
|
||||
});
|
||||
expect(blocksWithLabel).toHaveLength(50);
|
||||
expect(blocksWithLabel?.[0]).toMatchObject({
|
||||
type: "section",
|
||||
fields: [{ text: "🛠️ *Exec 10*" }, { text: "run 10" }],
|
||||
});
|
||||
expect(blocksWithLabel?.at(-1)).toMatchObject({
|
||||
type: "section",
|
||||
fields: [{ text: "🛠️ *Exec 59*" }, { text: "run 59" }],
|
||||
});
|
||||
expectProgressBlock(blocksWithLabel?.[0], "Exec 10", "run 10");
|
||||
expectProgressBlock(blocksWithLabel?.at(-1), "Exec 59", "run 59");
|
||||
|
||||
const blocksWithoutLabel = buildSlackProgressDraftBlocks({
|
||||
lines: Array.from({ length: 60 }, (_value, index) => progressLine(index)),
|
||||
});
|
||||
expect(blocksWithoutLabel).toHaveLength(50);
|
||||
expect(blocksWithoutLabel?.[0]).toMatchObject({
|
||||
type: "section",
|
||||
fields: [{ text: "🛠️ *Exec 10*" }, { text: "run 10" }],
|
||||
});
|
||||
expect(blocksWithoutLabel?.at(-1)).toMatchObject({
|
||||
type: "section",
|
||||
fields: [{ text: "🛠️ *Exec 59*" }, { text: "run 59" }],
|
||||
});
|
||||
expectProgressBlock(blocksWithoutLabel?.[0], "Exec 10", "run 10");
|
||||
expectProgressBlock(blocksWithoutLabel?.at(-1), "Exec 59", "run 59");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user