Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+43
-2
@@ -37,9 +37,9 @@ vi.mock("i18next", () => ({
|
||||
t: (key: string) => key,
|
||||
}));
|
||||
|
||||
async function callAction(values: Record<string, string>) {
|
||||
async function callActionResponse(values: Record<string, string>) {
|
||||
const body = new URLSearchParams(values);
|
||||
const response = (await action({
|
||||
return (await action({
|
||||
request: new Request("https://admin.example.test/email-sequences/seq-1", {
|
||||
method: "POST",
|
||||
body,
|
||||
@@ -49,6 +49,10 @@ async function callAction(values: Record<string, string>) {
|
||||
context: {},
|
||||
unstable_pattern: "admin/email-sequences/:id",
|
||||
} as ActionFunctionArgs)) as Response;
|
||||
}
|
||||
|
||||
async function callAction(values: Record<string, string>) {
|
||||
const response = await callActionResponse(values);
|
||||
return response.json();
|
||||
}
|
||||
|
||||
@@ -94,4 +98,41 @@ describe("admin email sequence detail action", () => {
|
||||
});
|
||||
expect(db.emailSequence.update).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not expose the email-sequence engine error in validation feedback", async () => {
|
||||
const result = await callAction({
|
||||
name: "Welcome",
|
||||
triggerEvent: "lead.captured",
|
||||
stepsJson: "{}",
|
||||
});
|
||||
|
||||
expect(result).toEqual({
|
||||
ok: false,
|
||||
error: "translated:admin.emailSequences.errors.stepsJsonValidationFailed",
|
||||
field: "stepsJson",
|
||||
});
|
||||
expect(db.emailSequence.update).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("redirects with an action-specific toast after enabling a sequence", async () => {
|
||||
const response = await callActionResponse({ intent: "toggle" });
|
||||
|
||||
expect(response.status).toBe(302);
|
||||
expect(response.headers.get("Location")).toContain(
|
||||
`toast=${encodeURIComponent("admin.emailSequences.toast.enabled")}`
|
||||
);
|
||||
});
|
||||
|
||||
it("redirects with the saved toast after updating a sequence", async () => {
|
||||
const response = await callActionResponse({
|
||||
name: "Welcome",
|
||||
triggerEvent: "lead.captured",
|
||||
stepsJson: "[]",
|
||||
});
|
||||
|
||||
expect(response.status).toBe(302);
|
||||
expect(response.headers.get("Location")).toContain(
|
||||
`toast=${encodeURIComponent("admin.emailSequences.toast.saved")}`
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user