diff --git a/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS.md b/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS.md index e120863f7e..ed4f36cc20 100644 --- a/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS.md +++ b/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS.md @@ -4,6 +4,6 @@ # Variable: MOCKS -> `const` **MOCKS**: (\{ `request`: \{ `notifyOnNetworkStatusChange`: `boolean`; `query`: `DocumentNode`; `variables`: \{ `address`: `undefined`; `description`: `undefined`; `filter`: `string`; `first`: `number`; `image`: `undefined`; `name`: `undefined`; `orderBy`: `string`; `skip`: `number`; `userId`: `undefined`; `userRegistrationRequired`: `undefined`; `visibleInSearch`: `undefined`; \}; \}; `result`: \{ `data`: \{ `createOrganization`: `undefined`; `createSampleOrganization`: `undefined`; `organizationsConnection`: [`InterfaceOrgInfoTypePG`](../../../../utils/interfaces/interfaces/InterfaceOrgInfoTypePG.md)[]; `user`: `undefined`; \}; \}; \} \| \{ `request`: \{ `notifyOnNetworkStatusChange`: `undefined`; `query`: `DocumentNode`; `variables`: \{ `address`: `undefined`; `description`: `undefined`; `filter`: `undefined`; `first`: `undefined`; `image`: `undefined`; `name`: `undefined`; `orderBy`: `undefined`; `skip`: `undefined`; `userId`: `string`; `userRegistrationRequired`: `undefined`; `visibleInSearch`: `undefined`; \}; \}; `result`: \{ `data`: \{ `createOrganization`: `undefined`; `createSampleOrganization`: `undefined`; `organizationsConnection`: `undefined`; `user`: [`InterfaceUserType`](../../../../utils/interfaces/interfaces/InterfaceUserType.md); \}; \}; \} \| \{ `request`: \{ `notifyOnNetworkStatusChange`: `undefined`; `query`: `DocumentNode`; `variables`: `undefined`; \}; `result`: \{ `data`: \{ `createOrganization`: `undefined`; `createSampleOrganization`: \{ `id`: `string`; `name`: `string`; \}; `organizationsConnection`: `undefined`; `user`: `undefined`; \}; \}; \} \| \{ `request`: \{ `notifyOnNetworkStatusChange`: `undefined`; `query`: `DocumentNode`; `variables`: \{ `address`: \{ `city`: `string`; `countryCode`: `string`; `dependentLocality`: `string`; `line1`: `string`; `line2`: `string`; `postalCode`: `string`; `sortingCode`: `string`; `state`: `string`; \}; `description`: `string`; `filter`: `undefined`; `first`: `undefined`; `image`: `string`; `name`: `string`; `orderBy`: `undefined`; `skip`: `undefined`; `userId`: `undefined`; `userRegistrationRequired`: `boolean`; `visibleInSearch`: `boolean`; \}; \}; `result`: \{ `data`: \{ `createOrganization`: \{ `_id`: `string`; \}; `createSampleOrganization`: `undefined`; `organizationsConnection`: `undefined`; `user`: `undefined`; \}; \}; \})[] +> `const` **MOCKS**: (\{ `request`: \{ `query`: `DocumentNode`; `variables`: \{ `address`: `undefined`; `description`: `undefined`; `first`: `undefined`; `id`: `undefined`; `image`: `undefined`; `name`: `undefined`; `userId`: `string`; `userRegistrationRequired`: `undefined`; `visibleInSearch`: `undefined`; \}; \}; `result`: \{ `data`: \{ `createOrganization`: `undefined`; `createSampleOrganization`: `undefined`; `user`: [`InterfaceUserType`](../../../../utils/interfaces/interfaces/InterfaceUserType.md); \}; \}; \} \| \{ `request`: \{ `query`: `DocumentNode`; `variables`: `undefined`; \}; `result`: \{ `data`: \{ `createOrganization`: `undefined`; `createSampleOrganization`: \{ `id`: `string`; `name`: `string`; \}; `user`: `undefined`; \}; \}; \} \| \{ `request`: \{ `query`: `DocumentNode`; `variables`: \{ `address`: \{ `city`: `string`; `countryCode`: `string`; `dependentLocality`: `string`; `line1`: `string`; `line2`: `string`; `postalCode`: `string`; `sortingCode`: `string`; `state`: `string`; \}; `description`: `string`; `first`: `undefined`; `id`: `undefined`; `image`: `string`; `name`: `string`; `userId`: `undefined`; `userRegistrationRequired`: `boolean`; `visibleInSearch`: `boolean`; \}; \}; `result`: \{ `data`: \{ `createOrganization`: \{ `_id`: `string`; \}; `createSampleOrganization`: `undefined`; `user`: `undefined`; \}; \}; \} \| \{ `request`: \{ `query`: `DocumentNode`; `variables`: \{ `address`: `undefined`; `description`: `undefined`; `first`: `number`; `id`: `string`; `image`: `undefined`; `name`: `undefined`; `userId`: `undefined`; `userRegistrationRequired`: `undefined`; `visibleInSearch`: `undefined`; \}; \}; `result`: \{ `data`: \{ `createOrganization`: `undefined`; `createSampleOrganization`: `undefined`; `user`: \{ `organizationsWhereMember`: \{ `edges`: `object`[]; `pageInfo`: \{ `hasNextPage`: `boolean`; \}; \}; \}; \}; \}; \} \| \{ `request`: \{ `query`: `DocumentNode`; `variables`: \{ `address`: `undefined`; `description`: `undefined`; `first`: `number`; `id`: `string`; `image`: `undefined`; `name`: `undefined`; `userId`: `undefined`; `userRegistrationRequired`: `undefined`; `visibleInSearch`: `undefined`; \}; \}; `result`: \{ `data`: \{ `createOrganization`: `undefined`; `createSampleOrganization`: `undefined`; `user`: \{ `organizationsWhereMember`: \{ `edges`: `object`[]; `pageInfo`: `undefined`; \}; \}; \}; \}; \})[] Defined in: [src/screens/OrgList/OrgListMocks.ts:79](https://github.com/PalisadoesFoundation/talawa-admin/blob/main/src/screens/OrgList/OrgListMocks.ts#L79) diff --git a/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_ADMIN.md b/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_ADMIN.md index 735ed14682..868274c86f 100644 --- a/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_ADMIN.md +++ b/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_ADMIN.md @@ -6,4 +6,4 @@ > `const` **MOCKS\_ADMIN**: (\{ `request`: \{ `notifyOnNetworkStatusChange`: `boolean`; `query`: `DocumentNode`; `variables`: \{ `filter`: `string`; `first`: `number`; `orderBy`: `string`; `skip`: `number`; `userId`: `undefined`; \}; \}; `result`: \{ `data`: \{ `organizationsConnection`: [`InterfaceOrgInfoTypePG`](../../../../utils/interfaces/interfaces/InterfaceOrgInfoTypePG.md)[]; `user`: `undefined`; \}; \}; \} \| \{ `request`: \{ `notifyOnNetworkStatusChange`: `undefined`; `query`: `DocumentNode`; `variables`: \{ `filter`: `undefined`; `first`: `undefined`; `orderBy`: `undefined`; `skip`: `undefined`; `userId`: `string`; \}; \}; `result`: \{ `data`: \{ `organizationsConnection`: `undefined`; `user`: [`InterfaceUserType`](../../../../utils/interfaces/interfaces/InterfaceUserType.md); \}; \}; \})[] -Defined in: [src/screens/OrgList/OrgListMocks.ts:213](https://github.com/PalisadoesFoundation/talawa-admin/blob/main/src/screens/OrgList/OrgListMocks.ts#L213) +Defined in: [src/screens/OrgList/OrgListMocks.ts:283](https://github.com/PalisadoesFoundation/talawa-admin/blob/main/src/screens/OrgList/OrgListMocks.ts#L283) diff --git a/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_EMPTY.md b/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_EMPTY.md index 61f55168d3..1cb39c5db5 100644 --- a/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_EMPTY.md +++ b/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_EMPTY.md @@ -6,4 +6,4 @@ > `const` **MOCKS\_EMPTY**: (\{ `request`: \{ `notifyOnNetworkStatusChange`: `boolean`; `query`: `DocumentNode`; `variables`: \{ `filter`: `string`; `first`: `number`; `orderBy`: `string`; `skip`: `number`; `userId`: `undefined`; \}; \}; `result`: \{ `data`: \{ `organizationsConnection`: `any`[]; `user`: `undefined`; \}; \}; \} \| \{ `request`: \{ `notifyOnNetworkStatusChange`: `undefined`; `query`: `DocumentNode`; `variables`: \{ `filter`: `undefined`; `first`: `undefined`; `orderBy`: `undefined`; `skip`: `undefined`; `userId`: `string`; \}; \}; `result`: \{ `data`: \{ `organizationsConnection`: `undefined`; `user`: [`InterfaceUserType`](../../../../utils/interfaces/interfaces/InterfaceUserType.md); \}; \}; \})[] -Defined in: [src/screens/OrgList/OrgListMocks.ts:149](https://github.com/PalisadoesFoundation/talawa-admin/blob/main/src/screens/OrgList/OrgListMocks.ts#L149) +Defined in: [src/screens/OrgList/OrgListMocks.ts:219](https://github.com/PalisadoesFoundation/talawa-admin/blob/main/src/screens/OrgList/OrgListMocks.ts#L219) diff --git a/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_WITH_ERROR.md b/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_WITH_ERROR.md index c3c2968c45..c6cf94d2e5 100644 --- a/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_WITH_ERROR.md +++ b/docs/docs/auto-docs/screens/OrgList/OrgListMocks/variables/MOCKS_WITH_ERROR.md @@ -6,4 +6,4 @@ > `const` **MOCKS\_WITH\_ERROR**: (\{ `error`: `undefined`; `request`: \{ `notifyOnNetworkStatusChange`: `boolean`; `query`: `DocumentNode`; `variables`: \{ `filter`: `string`; `first`: `number`; `orderBy`: `string`; `skip`: `number`; `userId`: `undefined`; \}; \}; `result`: \{ `data`: \{ `organizationsConnection`: [`InterfaceOrgInfoTypePG`](../../../../utils/interfaces/interfaces/InterfaceOrgInfoTypePG.md)[]; `user`: `undefined`; \}; \}; \} \| \{ `error`: `undefined`; `request`: \{ `notifyOnNetworkStatusChange`: `undefined`; `query`: `DocumentNode`; `variables`: \{ `filter`: `undefined`; `first`: `undefined`; `orderBy`: `undefined`; `skip`: `undefined`; `userId`: `string`; \}; \}; `result`: \{ `data`: \{ `organizationsConnection`: `undefined`; `user`: [`InterfaceUserType`](../../../../utils/interfaces/interfaces/InterfaceUserType.md); \}; \}; \} \| \{ `error`: `Error`; `request`: \{ `notifyOnNetworkStatusChange`: `undefined`; `query`: `DocumentNode`; `variables`: `undefined`; \}; `result`: `undefined`; \})[] -Defined in: [src/screens/OrgList/OrgListMocks.ts:177](https://github.com/PalisadoesFoundation/talawa-admin/blob/main/src/screens/OrgList/OrgListMocks.ts#L177) +Defined in: [src/screens/OrgList/OrgListMocks.ts:247](https://github.com/PalisadoesFoundation/talawa-admin/blob/main/src/screens/OrgList/OrgListMocks.ts#L247) diff --git a/src/screens/OrgList/OrgList.spec.tsx b/src/screens/OrgList/OrgList.spec.tsx index 6e6eb2566b..ac5ba7cb5a 100644 --- a/src/screens/OrgList/OrgList.spec.tsx +++ b/src/screens/OrgList/OrgList.spec.tsx @@ -177,6 +177,33 @@ describe('Organisations Page testing as SuperAdmin', () => { await wait(); }); + test('testing scroll', async () => { + setItem('id', '123'); + + render( + + + + + + + + + , + ); + + await waitFor(() => { + expect(screen.queryByText(/Create Organization/i)).toBeNull(); + }); + + // Wait for initial organizations to load + expect(await screen.findByText('Organization 1')).toBeInTheDocument(); + expect(await screen.findByText('Organization 2')).toBeInTheDocument(); + + // Simulate infinite scroll trigger (fetchMore) + fireEvent.scroll(window, { target: { scrollY: 2000 } }); + }); + // test('Testing create organization modal', async () => { // setItem('id', '123'); // setItem('SuperAdmin', true); diff --git a/src/screens/OrgList/OrgListMocks.ts b/src/screens/OrgList/OrgListMocks.ts index 920f6d79b1..46994f695e 100644 --- a/src/screens/OrgList/OrgListMocks.ts +++ b/src/screens/OrgList/OrgListMocks.ts @@ -77,23 +77,6 @@ const organizations: InterfaceOrgInfoTypePG[] = [ // MOCKS FOR SUPERADMIN const MOCKS = [ - { - request: { - query: USER_JOINED_ORGANIZATIONS_PG, - variables: { - first: 8, - skip: 0, - filter: '', - orderBy: 'createdAt_ASC', - }, - notifyOnNetworkStatusChange: true, - }, - result: { - data: { - organizationsConnection: organizations, - }, - }, - }, { request: { query: CURRENT_USER, @@ -145,6 +128,93 @@ const MOCKS = [ }, }, }, + { + request: { + query: USER_JOINED_ORGANIZATIONS_PG, + variables: { + id: '123', + first: 8, + }, + }, + result: { + data: { + user: { + organizationsWhereMember: { + pageInfo: { + hasNextPage: true, + }, + edges: [ + { + node: { + id: 'org1', + name: 'Organization 1', + avatarURL: 'image1.jpg', + addressLine1: 'Address 1', + description: 'Description 1', + members: { + edges: [ + { + node: { + id: 'abc', + }, + }, + ], + }, + }, + }, + { + node: { + id: 'org2', + name: 'Organization 2', + avatarURL: 'image2.jpg', + addressLine1: 'Address 2', + description: 'Description 2', + members: { + edges: [ + { + node: { + id: 'def', + }, + }, + ], + }, + }, + }, + ], + }, + }, + }, + }, + }, + { + request: { + query: USER_JOINED_ORGANIZATIONS_PG, + variables: { + id: '123', + first: 8, + }, + }, + result: { + data: { + user: { + organizationsWhereMember: { + edges: [ + { + node: { + id: 'org3', + name: 'Organization 3', + image: 'image3.jpg', + address: 'Address 3', + members: [{ id: 'm3' }], + admins: [{ id: 'a3' }], + }, + }, + ], + }, + }, + }, + }, + }, ]; const MOCKS_EMPTY = [ {