Skip to content

Commit

Permalink
test(clerk-js): Add tests for OrganizationProfile custom pages
Browse files Browse the repository at this point in the history
  • Loading branch information
anagstef committed Oct 6, 2023
1 parent 59cd9ea commit 3fe7470
Show file tree
Hide file tree
Showing 3 changed files with 634 additions and 293 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { CustomPage } from '@clerk/types';
import { describe, it } from '@jest/globals';
import React from 'react';

Expand All @@ -19,4 +20,37 @@ describe('OrganizationProfile', () => {
expect(getByText('Members')).toBeDefined();
expect(getByText('Settings')).toBeDefined();
});

it('includes custom nav items', async () => {
const { wrapper, props } = await createFixtures(f => {
f.withOrganizations();
f.withUser({ email_addresses: ['[email protected]'], organization_memberships: ['Org1'] });
});

const customPages: CustomPage[] = [
{
label: 'Custom1',
url: 'custom1',
mount: () => undefined,
unmount: () => undefined,
mountIcon: () => undefined,
unmountIcon: () => undefined,
},
{
label: 'ExternalLink',
url: '/link',
mountIcon: () => undefined,
unmountIcon: () => undefined,
},
];

props.setProps({ customPages });

const { getByText } = render(<OrganizationProfile />, { wrapper });
expect(getByText('Org1')).toBeDefined();
expect(getByText('Members')).toBeDefined();
expect(getByText('Settings')).toBeDefined();
expect(getByText('Custom1')).toBeDefined();
expect(getByText('ExternalLink')).toBeDefined();
});
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { CustomPage } from '@clerk/types';
import { describe, it } from '@jest/globals';
import React from 'react';

import { bindCreateFixtures, render, screen } from '../../../../testUtils';
import type { CustomPage } from '../../../utils';
import { UserProfile } from '../UserProfile';

const { createFixtures } = bindCreateFixtures('UserProfile');
Expand Down
Loading

0 comments on commit 3fe7470

Please sign in to comment.