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
+38
@@ -0,0 +1,38 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const loadRegistrationPlanSelection = vi.fn();
|
||||
|
||||
vi.mock("~/services/billing/registration-plan-selection.server", () => ({
|
||||
loadRegistrationPlanSelection: (...args: unknown[]) => loadRegistrationPlanSelection(...args),
|
||||
}));
|
||||
|
||||
import { loader } from "./auth.registration-plan-advice";
|
||||
|
||||
describe("registration plan advice resource", () => {
|
||||
beforeEach(() => loadRegistrationPlanSelection.mockReset());
|
||||
|
||||
it("returns a no-store server-built recommendation for valid team sizes", async () => {
|
||||
const selection = { recommendedPriceId: "price_pro", plans: [] };
|
||||
loadRegistrationPlanSelection.mockResolvedValue(selection);
|
||||
|
||||
const response = await loader({ request: new Request("https://app.test/auth/registration-plan-advice?office=5&field=15") } as never);
|
||||
|
||||
expect(loadRegistrationPlanSelection).toHaveBeenCalledWith(null, { officeSeatQuantity: 5, fieldSeatQuantity: 15 });
|
||||
expect(response.headers.get("Cache-Control")).toBe("private, no-store");
|
||||
await expect(response.json()).resolves.toEqual(selection);
|
||||
});
|
||||
|
||||
it.each(["office=&field=1", "office=0&field=1", "office=1.5&field=1", "office=1&field=-1", "office=10001&field=1"])(
|
||||
"rejects invalid quantities without loading the catalog: %s",
|
||||
async (query) => {
|
||||
const failure = await loader({ request: new Request(`https://app.test/auth/registration-plan-advice?${query}`) } as never).catch(
|
||||
(error: Response) => error
|
||||
);
|
||||
expect(failure).toMatchObject({
|
||||
status: 400,
|
||||
});
|
||||
await expect(failure.json()).resolves.toEqual({ errorKey: "account.register.recommendationErrorBody" });
|
||||
expect(loadRegistrationPlanSelection).not.toHaveBeenCalled();
|
||||
}
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user