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
+10
-8
@@ -3,7 +3,7 @@ import { render, screen } from "@testing-library/react";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import AdminSettingsGeneral, { action } from "./general";
|
||||
import { getOrCreateAppConfiguration, updateAppConfiguration } from "~/utils/db/appConfiguration.db.server";
|
||||
import { updateAppConfiguration } from "~/utils/db/appConfiguration.db.server";
|
||||
import { createAdminLog } from "~/utils/db/logs.db.server";
|
||||
import { storeFile } from "~/utils/integrations/storageService";
|
||||
import { createUserSession } from "~/utils/session.server";
|
||||
@@ -51,7 +51,6 @@ vi.mock("~/utils/helpers/.server/PermissionsService", () => ({
|
||||
|
||||
vi.mock("~/utils/db/appConfiguration.db.server", () => ({
|
||||
getAppConfiguration: vi.fn(),
|
||||
getOrCreateAppConfiguration: vi.fn(),
|
||||
updateAppConfiguration: vi.fn(),
|
||||
}));
|
||||
|
||||
@@ -73,8 +72,8 @@ vi.mock("~/utils/data/useRootData", () => ({
|
||||
useRootData: () => ({ csrf: "csrf-test-token" }),
|
||||
}));
|
||||
|
||||
vi.mock("react-hot-toast", () => ({
|
||||
default: { success: vi.fn(), error: vi.fn() },
|
||||
vi.mock("sonner", () => ({
|
||||
toast: { success: vi.fn(), error: vi.fn() },
|
||||
}));
|
||||
|
||||
vi.mock("~/components/ui/layouts/EditPageLayout", () => ({
|
||||
@@ -136,7 +135,6 @@ vi.mock("~/components/ui/input/InputSelect", () => ({
|
||||
),
|
||||
}));
|
||||
|
||||
const getOrCreateAppConfigurationMock = vi.mocked(getOrCreateAppConfiguration);
|
||||
const updateAppConfigurationMock = vi.mocked(updateAppConfiguration);
|
||||
const createAdminLogMock = vi.mocked(createAdminLog);
|
||||
const storeFileMock = vi.mocked(storeFile);
|
||||
@@ -178,7 +176,6 @@ describe("admin general settings route", () => {
|
||||
scripts: { head: "", body: "" },
|
||||
},
|
||||
};
|
||||
getOrCreateAppConfigurationMock.mockResolvedValue(undefined as never);
|
||||
updateAppConfigurationMock.mockResolvedValue(undefined as never);
|
||||
createAdminLogMock.mockResolvedValue(undefined as never);
|
||||
createUserSessionMock.mockResolvedValue(new Response(null, { status: 204 }) as never);
|
||||
@@ -193,7 +190,6 @@ describe("admin general settings route", () => {
|
||||
|
||||
expect((response as Response).status).toBe(400);
|
||||
expect(body.fieldErrors.action).toEqual(["Invalid action."]);
|
||||
expect(getOrCreateAppConfigurationMock).not.toHaveBeenCalled();
|
||||
expect(updateAppConfigurationMock).not.toHaveBeenCalled();
|
||||
expect(storeFileMock).not.toHaveBeenCalled();
|
||||
expect(createAdminLogMock).not.toHaveBeenCalled();
|
||||
@@ -208,7 +204,6 @@ describe("admin general settings route", () => {
|
||||
|
||||
expect((response as Response).status).toBe(400);
|
||||
expect(body.fieldErrors.name).toEqual(["This field is required."]);
|
||||
expect(getOrCreateAppConfigurationMock).not.toHaveBeenCalled();
|
||||
expect(updateAppConfigurationMock).not.toHaveBeenCalled();
|
||||
expect(storeFileMock).not.toHaveBeenCalled();
|
||||
expect(createAdminLogMock).not.toHaveBeenCalled();
|
||||
@@ -240,6 +235,13 @@ describe("admin general settings route", () => {
|
||||
expect(auditPayload).not.toContain("token=secret");
|
||||
});
|
||||
|
||||
it("uses the already MFA-assured AdminSession instead of a second HiveGrid TOTP stack", async () => {
|
||||
const response = await action({ request: postRequest(validForm()), params: {}, context: {}, unstable_pattern: "admin/settings/general" });
|
||||
|
||||
expect((response as Response).status).toBe(204);
|
||||
expect(updateAppConfigurationMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("renders accessible action and field errors", () => {
|
||||
routeActionData = { error: "settings.admin.invalid", fieldErrors: { name: ["This field is required."], action: ["Invalid action."] } };
|
||||
|
||||
|
||||
Reference in new issue
Block a user