Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMalfait committed Dec 22, 2024
1 parent 2f1e0f1 commit 337ccf1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
23 changes: 16 additions & 7 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
{
export const rules = {
"general": {
"description": "Twenty is an open source CRM built with React, NestJS, and PostgreSQL",
"description": "Twenty is an open source CRM built with Typescript (React, NestJS).",
"main-packages": {
"frontend": "packages/twenty-front - React frontend application",
"server": "packages/twenty-server - NestJS backend application",
"website": "packages/twenty-website - Marketing website (includes some documentation)"
"twenty-front": "Main Frontend - React",
"twenty-server": "Main Backend - NestJS",
"twenty-website": "Marketing website (includes some documentation) - NextJS",
"twenty-ui": "UI library - React",
"twenty-shared": "Anything shared between multiple packages (e.g. utils, constants, types, etc.). Shouldn't be raw TS and not NestJS or React specific."
},
"development": {
"package-manager": "yarn",
"monorepo-tool": "nx"
"monorepo-tool": "nx",
"database": "PostgreSQL",
"orm": "TypeORM",
"orm-schema": "core, metadata",
"cahce": "redis",
"auth": "JWT",
"queue": "BullMQ",
"storage": "S3 or local filesystem"
},
"common-commands": {
"frontend": {
Expand Down Expand Up @@ -116,4 +125,4 @@
"Follow proper test naming conventions"
]
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const setupMockIsLogged = (isLogged: boolean) => {
};

jest.mock('@/billing/hooks/useBillingPlan');
const setupMockBillingPlan = (plan: BillingPlanKey) => {
const setupMockBillingPlan = (plan: BillingPlanKey | null) => {
jest.mocked(useBillingPlan).mockReturnValueOnce(plan);
};

Expand Down Expand Up @@ -291,7 +291,7 @@ describe('usePageChangeEffectNavigateLocation', () => {
setupMockOnboardingStatus(testCase.onboardingStatus);
setupMockSubscriptionStatus(testCase.subscriptionStatus);
setupMockIsLogged(testCase.isLoggedIn);
setupMockBillingPlan(BillingPlanKey.PRO);
setupMockBillingPlan(null);
expect(usePageChangeEffectNavigateLocation()).toEqual(testCase.res);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ const Wrapper = ({ children, initialUrl = '' }: any) => (
);

describe('useBillingPlan', () => {
it('should return FREE as default plan', () => {
it('should return null as default plan', () => {
const { result } = renderHook(() => useBillingPlan(), {
wrapper: Wrapper,
});

expect(result.current).toBe(BillingPlanKey.FREE);
expect(result.current).toBe(null);
});

it('should set plan from URL parameter - FREE', () => {
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('useBillingPlan', () => {
),
});

expect(result.current).toBe(BillingPlanKey.FREE);
expect(result.current).toBe(null);
});

it('should handle URL without plan parameter', () => {
Expand All @@ -67,6 +67,6 @@ describe('useBillingPlan', () => {
),
});

expect(result.current).toBe(BillingPlanKey.FREE);
expect(result.current).toBe(null);
});
});

0 comments on commit 337ccf1

Please sign in to comment.