Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -15,6 +15,10 @@ vi.mock("~/utils/db/users.db.server", () => ({
getUser: vi.fn(async () => ({ id: "user_123", email: "user@example.com" })),
}));
vi.mock("~/locale/i18next.server", () => ({
getTranslations: vi.fn(async () => ({ t: (key: string) => key })),
}));
vi.mock("~/modules/notifications/services/.server/NotificationService", () => ({
default: {
deleteNotificationTemplate: vi.fn(async () => null),
@@ -24,11 +28,13 @@ vi.mock("~/modules/notifications/services/.server/NotificationService", () => ({
}));
import { verifyUserHasPermission } from "~/utils/helpers/.server/PermissionsService";
import NotificationService from "~/modules/notifications/services/.server/NotificationService";
import { action } from "./channels";
function callAction() {
function callAction(actionName = "create", fields: Record<string, string> = {}) {
const form = new FormData();
form.set("action", "create");
form.set("action", actionName);
for (const [key, value] of Object.entries(fields)) form.set(key, value);
return action({
request: new Request("https://admin.example.test/notifications/channels", {
method: "POST",
@@ -49,4 +55,22 @@ describe("admin notification channels action", () => {
await callAction();
expect(verifyUserHasPermission).toHaveBeenCalledWith(expect.any(Request), "admin.notifications.manage");
});
it("does not expose provider diagnostics when deletion fails", async () => {
vi.mocked(NotificationService.deleteNotificationTemplate).mockRejectedValueOnce(new Error("provider token expired"));
const response = await callAction("delete", { id: "template_123" });
expect(response).toBeInstanceOf(Response);
await expect((response as Response).json()).resolves.toEqual({ error: "notifications.admin.templates.errors.deleteFailed" });
});
it("does not expose provider diagnostics when preview delivery fails", async () => {
vi.mocked(NotificationService.send).mockRejectedValueOnce(new Error("provider request leaked details"));
const response = await callAction("send-preview", { channel: "in_app" });
expect(response).toBeInstanceOf(Response);
await expect((response as Response).json()).resolves.toEqual({ error: "notifications.admin.templates.errors.previewFailed" });
});
});