mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 02:18:25 +00:00
test: dedupe line rich menu label truncation checks
This commit is contained in:
@@ -22,13 +22,6 @@ describe("messageAction", () => {
|
|||||||
|
|
||||||
expect((action as { text: string }).text).toBe("Click");
|
expect((action as { text: string }).text).toBe("Click");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("truncates label to 20 characters", () => {
|
|
||||||
const action = messageAction("This is a very long label text");
|
|
||||||
|
|
||||||
expect((action.label ?? "").length).toBe(20);
|
|
||||||
expect(action.label).toBe("This is a very long ");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("uriAction", () => {
|
describe("uriAction", () => {
|
||||||
@@ -39,10 +32,21 @@ describe("uriAction", () => {
|
|||||||
expect(action.label).toBe("Open");
|
expect(action.label).toBe("Open");
|
||||||
expect((action as { uri: string }).uri).toBe("https://example.com");
|
expect((action as { uri: string }).uri).toBe("https://example.com");
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("truncates label to 20 characters", () => {
|
describe("action label truncation", () => {
|
||||||
const action = uriAction("Click here to visit our website", "https://example.com");
|
it.each([
|
||||||
|
{
|
||||||
|
createAction: () => messageAction("This is a very long label text"),
|
||||||
|
expectedLabel: "This is a very long ",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createAction: () => uriAction("Click here to visit our website", "https://example.com"),
|
||||||
|
expectedLabel: "Click here to visit ",
|
||||||
|
},
|
||||||
|
])("truncates labels to 20 characters", ({ createAction, expectedLabel }) => {
|
||||||
|
const action = createAction();
|
||||||
|
expect(action.label).toBe(expectedLabel);
|
||||||
expect((action.label ?? "").length).toBe(20);
|
expect((action.label ?? "").length).toBe(20);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user