diff --git a/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.test.tsx b/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.test.tsx index 060dd2b59d..028b6120c1 100644 --- a/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.test.tsx +++ b/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.test.tsx @@ -3,7 +3,7 @@ import { noop } from 'lodash'; import { Claims } from '@/constants/claims'; import { DocumentRow } from '@/features/documents/ComposedDocument'; -import { mockDocumentsResponse } from '@/mocks/documents.mock'; +import { mockDocumentResponse, mockDocumentsResponse } from '@/mocks/documents.mock'; import { cleanup, mockKeycloak, render, RenderOptions } from '@/utils/test-utils'; import { DocumentResults, IDocumentResultProps } from './DocumentResults'; @@ -121,13 +121,12 @@ describe('Document Results Table', () => { expect(deleteButtons[0]).toBeVisible(); }); - it('displays document delete button', async () => { - mockKeycloak({ claims: [Claims.DOCUMENT_VIEW, Claims.DOCUMENT_DELETE] }); - const { getAllByTestId } = setup({ - results: mockDocumentsResponse().map(x => DocumentRow.fromApi(x)), - }); - - const deleteButtons = await getAllByTestId('document-delete-button'); - expect(deleteButtons[0]).toBeVisible(); + it('displays default number of entries of 10', async () => { + mockKeycloak({ claims: [Claims.DOCUMENT_VIEW] }); + const largeDataset = Array.from({ length: 15 }, (id: number) => + DocumentRow.fromApi(mockDocumentResponse(id)), + ); + const { findByText } = setup({ results: largeDataset }); + expect(await findByText('1 - 10 of 15')).toBeVisible(); }); }); diff --git a/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.tsx b/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.tsx index 50098afc34..f49e116450 100644 --- a/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.tsx +++ b/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.tsx @@ -33,7 +33,7 @@ export const DocumentResults: React.FunctionComponent< externalSort={{ sort, setSort }} data={results ?? []} noRowsMessage="No matching Documents found" - pageSize={1} + pageSize={10} manualPagination={false} {...rest} > diff --git a/source/frontend/src/mocks/documents.mock.ts b/source/frontend/src/mocks/documents.mock.ts index ec7f7b7f06..1fa7f982da 100644 --- a/source/frontend/src/mocks/documents.mock.ts +++ b/source/frontend/src/mocks/documents.mock.ts @@ -5,6 +5,51 @@ import { Api_Storage_DocumentTypeMetadataType, } from '@/models/api/DocumentStorage'; +export const mockDocumentResponse = (id = 1): Api_DocumentRelationship => ({ + id, + parentId: 1, + isDisabled: false, + document: { + id: 21, + mayanDocumentId: 33, + documentType: { + id: 8, + documentType: 'MoTI Plan', + documentTypeDescription: 'MOTIPLAN', + mayanId: 24, + appCreateTimestamp: '2022-09-08T21:18:09.01', + appLastUpdateTimestamp: '2022-09-08T21:18:09.01', + appLastUpdateUserid: 'admin', + appCreateUserid: 'admin', + appLastUpdateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + appCreateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + rowVersion: 1, + isDisabled: false, + }, + statusTypeCode: { + id: 'AMENDD', + description: 'Amended', + isDisabled: false, + }, + fileName: 'moti_plan.txt', + appCreateTimestamp: '2022-09-08T21:18:54.057', + appLastUpdateTimestamp: '2022-09-08T21:18:54.057', + appLastUpdateUserid: 'admin', + appCreateUserid: 'admin', + appLastUpdateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + appCreateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + rowVersion: 1, + }, + relationshipType: DocumentRelationshipType.ACQUISITION_FILES, + appCreateTimestamp: '2022-09-08T21:18:54.057', + appLastUpdateTimestamp: '2022-09-08T21:18:54.057', + appLastUpdateUserid: 'admin', + appCreateUserid: 'admin', + appLastUpdateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + appCreateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + rowVersion: 1, +}); + export const mockDocumentsResponse = (): Api_DocumentRelationship[] => [ { id: 1,