Skip to content

Commit bf211d3

Browse files
committed
fix type error
1 parent 123552a commit bf211d3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/shared/src/react/hooks/__tests__/usePlans.spec.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ const mockOrganization: any = { id: 'org_1' };
88
const getPlansSpy = vi.fn((args: any) =>
99
Promise.resolve({
1010
// pageSize maps to limit; default to 10 if missing
11-
data: Array.from({ length: args.limit ?? args.pageSize ?? 10 }, (_, i) => ({ id: `plan_${i + 1}`, for: args.for })),
11+
data: Array.from<Partial<BillingPlanResource>, Partial<BillingPlanResource>>(
12+
{ length: args.limit ?? args.pageSize ?? 10 },
13+
(_, i) => ({ id: `plan_${i + 1}`, forPayerType: args.for }),
14+
),
1215
total_count: 25,
1316
}),
1417
);
@@ -38,6 +41,8 @@ vi.mock('../../contexts', () => {
3841
};
3942
});
4043

44+
import type { BillingPlanResource } from '@clerk/types';
45+
4146
import { usePlans } from '../usePlans';
4247
import { wrapper } from './wrapper';
4348

@@ -150,12 +155,12 @@ describe('usePlans', () => {
150155
it('conditionally renders hooks based on prop passed to render', async () => {
151156
const UserPlansCount = () => {
152157
const userPlans = usePlans({ initialPage: 1, pageSize: 2 });
153-
return <div data-testid='user-type'>{userPlans.data.map(p => p.for)[0]}</div>;
158+
return <div data-testid='user-type'>{userPlans.data.map(p => p.forPayerType)[0]}</div>;
154159
};
155160

156161
const OrgPlansCount = () => {
157162
const orgPlans = usePlans({ initialPage: 1, pageSize: 2, for: 'organization' } as any);
158-
return <div data-testid='org-type'>{orgPlans.data.map(p => p.for)[0]}</div>;
163+
return <div data-testid='org-type'>{orgPlans.data.map(p => p.forPayerType)[0]}</div>;
159164
};
160165

161166
const Conditional = ({ showOrg }: { showOrg: boolean }) => (showOrg ? <OrgPlansCount /> : <UserPlansCount />);

0 commit comments

Comments
 (0)