diff --git a/src/js/mock/managementClientMSWHandlers.ts b/src/js/mock/managementClientMSWHandlers.ts index ae7227626..8c9aad414 100644 --- a/src/js/mock/managementClientMSWHandlers.ts +++ b/src/js/mock/managementClientMSWHandlers.ts @@ -15,6 +15,7 @@ export const TRANSITION_WORKFLOW_CURRENT_ID = '0d55a1d7-349c-4e79-932b-b502bcc45a8f'; export const TRANSITION_WORKFLOW_PREVIOUS_ID = '1e55a1d7-349c-4e79-932b-b502bcc45a8f'; +export const EXPIRATION_WORKFLOW_ID = '330f2359-dc93-4abd-97c1-37c8483b1872'; export const TRIGGER_DELAY_DAYS = 15; export const COLD_LOCATION_NAME = 'europe25-myroom-cold'; @@ -266,6 +267,18 @@ export const getColdStorageHandlers = (baseUrl: string, instanceId: string) => [ enabled: true, }, }, + { + expiration: { + bucketName: BUCKET_NAME, + enabled: true, + filter: { + objectTags: null, + }, + type: 'bucket-workflow-expiration-v1', + workflowId: EXPIRATION_WORKFLOW_ID, + previousVersionTriggerDelayDays: 7, + }, + }, ]), ), ), diff --git a/src/react/workflow/ExpirationForm.tsx b/src/react/workflow/ExpirationForm.tsx index acaea2d1a..a797a9c7f 100644 --- a/src/react/workflow/ExpirationForm.tsx +++ b/src/react/workflow/ExpirationForm.tsx @@ -390,7 +390,7 @@ export function ExpirationForm({ prefix = '' }: Props) { }) => ( { beforeAll(() => { server.listen({ onUnhandledRequest: 'error' }); - mockOffsetSize(200, 800); + mockOffsetSize(200, 1000); }); afterEach(() => { server.resetHandlers(); @@ -136,4 +139,36 @@ describe('Workflows', () => { ), ).toBeInTheDocument(); }); + + it('should display the correct expiration form', async () => { + //S + server.use( + mockBucketListing([ + { + Name: BUCKET_NAME, + CreationDate: new Date('2021-03-18T12:51:44Z'), + }, + ]), + mockBucketOperations({ + isVersioningEnabled: (bucketName) => bucketName === BUCKET_NAME, + }), + ); + renderWithRouterMatch( + , + { + path: '/accounts/:accountName/workflows/:workflowId?', + route: `/accounts/${TEST_ACCOUNT}/workflows/expiration-${EXPIRATION_WORKFLOW_ID}`, + }, + { instances: { selectedId: INSTANCE_ID } }, + ); + //E + await waitFor(() => screen.getByText(TEST_ACCOUNT)); + await waitFor(() => screen.queryAllByText(/expiration/i)); + //V + expect( + screen.getByRole('checkbox', { + name: /Expire Previous version of objects/i, + }), + ).toBeChecked(); + }); });