refactor: rename hobby start action

This commit is contained in:
Matti Nannt
2026-03-13 16:33:33 +01:00
parent 71672f206c
commit 38e84f4e15
3 changed files with 8 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, test, vi } from "vitest";
import { startScaleTrialAction, stayOnHobbyAction } from "./actions";
import { startHobbyAction, startScaleTrialAction } from "./actions";
const mocks = vi.hoisted(() => ({
checkAuthorizationUpdated: vi.fn(),
@@ -83,8 +83,8 @@ describe("billing actions", () => {
mocks.syncOrganizationBillingFromStripe.mockResolvedValue(undefined);
});
test("stayOnHobbyAction ensures a customer, reconciles hobby, and syncs billing", async () => {
const result = await stayOnHobbyAction({
test("startHobbyAction ensures a customer, reconciles hobby, and syncs billing", async () => {
const result = await startHobbyAction({
ctx: { user: { id: "user_1" } },
parsedInput: { organizationId: "org_1" },
} as any);
@@ -103,7 +103,7 @@ describe("billing actions", () => {
expect(mocks.ensureStripeCustomerForOrganization).toHaveBeenCalledWith("org_1");
expect(mocks.reconcileCloudStripeSubscriptionsForOrganization).toHaveBeenCalledWith(
"org_1",
"stay-on-hobby"
"start-hobby"
);
expect(mocks.syncOrganizationBillingFromStripe).toHaveBeenCalledWith("org_1");
expect(result).toEqual({ success: true });

View File

@@ -150,7 +150,7 @@ const ZStartScaleTrialAction = z.object({
organizationId: ZId,
});
export const stayOnHobbyAction = authenticatedActionClient
export const startHobbyAction = authenticatedActionClient
.inputSchema(ZStartScaleTrialAction)
.action(async ({ ctx, parsedInput }) => {
await checkAuthorizationUpdated({
@@ -174,7 +174,7 @@ export const stayOnHobbyAction = authenticatedActionClient
throw new ResourceNotFoundError("OrganizationBilling", parsedInput.organizationId);
}
await reconcileCloudStripeSubscriptionsForOrganization(parsedInput.organizationId, "stay-on-hobby");
await reconcileCloudStripeSubscriptionsForOrganization(parsedInput.organizationId, "start-hobby");
await syncOrganizationBillingFromStripe(parsedInput.organizationId);
return { success: true };
});

View File

@@ -11,7 +11,7 @@ import ethereumLogo from "@/images/customer-logos/ethereum-logo.png";
import flixbusLogo from "@/images/customer-logos/flixbus-white.svg";
import githubLogo from "@/images/customer-logos/github-logo.png";
import siemensLogo from "@/images/customer-logos/siemens.png";
import { startScaleTrialAction, stayOnHobbyAction } from "@/modules/ee/billing/actions";
import { startHobbyAction, startScaleTrialAction } from "@/modules/ee/billing/actions";
import { Button } from "@/modules/ui/components/button";
interface SelectPlanCardProps {
@@ -64,7 +64,7 @@ export const SelectPlanCard = ({ nextUrl, organizationId }: SelectPlanCardProps)
const handleContinueFree = async () => {
setIsStayingOnHobby(true);
try {
const result = await stayOnHobbyAction({ organizationId });
const result = await startHobbyAction({ organizationId });
if (result?.data) {
router.push(nextUrl);
} else {