Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('useMemberManagementService', () => {
});

describe('providersQuery', () => {
it('should fetch identity providers when invitations tab is active', async () => {
it('should fetch identity providers with invitable member access levels filter', async () => {
const options = createDefaultOptions({ activeTab: 'invitations' });
const { result } = renderService(options);

Expand All @@ -84,7 +84,7 @@ describe('useMemberManagementService', () => {

expect(
mockCoreClient.getMyOrganizationApiClient().organization.identityProviders.list,
).toHaveBeenCalled();
).toHaveBeenCalledWith({ member_access_level: ['limited', 'full'] });
});

it('should not fetch identity providers when members tab is active', async () => {
Expand Down Expand Up @@ -128,15 +128,18 @@ describe('useMemberManagementService', () => {
const userStoresGetMock = () =>
mockCoreClient.getMyOrganizationApiClient().organization.userStores.list;

it('should fetch user stores when a tab is active', async () => {
it('should fetch user stores with enabled and invitable member access levels filter', async () => {
const options = createDefaultOptions({ activeTab: 'invitations' });
const { result } = renderService(options);

await waitFor(() => {
expect(result.current.userStoresQuery.isSuccess).toBe(true);
});

expect(userStoresGetMock()).toHaveBeenCalled();
expect(userStoresGetMock()).toHaveBeenCalledWith({
is_enabled: true,
member_access_level: ['limited', 'full'],
});
});

it('should not fetch user stores when no active tab is provided', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ export function useDomainTableService({
});
const allProviders = allProvidersResponse?.identity_providers ?? [];

return allProviders.filter(isIdpKnownResponse).map(
(provider): IdentityProviderAssociatedWithDomain => ({
return allProviders
.filter(isIdpKnownResponse)
.map((provider): IdentityProviderAssociatedWithDomain => ({
...provider,
is_associated: provider.domains?.includes(domainName) ?? false,
}),
);
}));
};

const domainsQuery = useQuery({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export function useMemberManagementService(
queryFn: async () => {
const response: ListIdentityProvidersResponseContent = await coreClient!
.getMyOrganizationApiClient()
.organization.identityProviders.list({ member_access_level: [...MEMBER_ACCESS_LEVELS] });
.organization.identityProviders.list({
member_access_level: [...MEMBER_ACCESS_LEVELS],
});
const providers = response.identity_providers?.filter(isIdpKnownResponse) ?? [];
return providers
.filter((p) => !!p.id)
Expand All @@ -111,9 +113,10 @@ export function useMemberManagementService(
const userStoresQuery = useQuery<ConnectionOption[]>({
queryKey: memberManagementQueryKeys.userStores(),
queryFn: async () => {
const page = await coreClient!
.getMyOrganizationApiClient()
.organization.userStores.list({ is_enabled: true });
const page = await coreClient!.getMyOrganizationApiClient().organization.userStores.list({
is_enabled: true,
member_access_level: [...MEMBER_ACCESS_LEVELS],
});
const userStores = page.user_stores ?? [];
return userStores
.filter((store) => !!store.id)
Expand Down