From 6bb8457bd20ee98f23e4c2a484de90c7c0c37fe8 Mon Sep 17 00:00:00 2001 From: Bogdan Nechyporenko Date: Mon, 16 Oct 2023 14:55:48 +0200 Subject: [PATCH] wip Signed-off-by: Bogdan Nechyporenko --- plugins/scaffolder/src/api.test.ts | 92 ------------------------------ 1 file changed, 92 deletions(-) diff --git a/plugins/scaffolder/src/api.test.ts b/plugins/scaffolder/src/api.test.ts index e10363b61f..edd27ba8f0 100644 --- a/plugins/scaffolder/src/api.test.ts +++ b/plugins/scaffolder/src/api.test.ts @@ -332,98 +332,6 @@ describe('api', () => { }); }); - describe('getTask', () => { - it('should return the task enriched with timestamps', async () => { - const taskId = 'e4e4cb25-e743-4b79-8572-87e9d35aa998'; - server.use( - rest.get(`${mockBaseUrl}/v2/tasks/:taskId`, (_req, res, ctx) => { - return res( - ctx.json({ - createdAt: '2023-10-16T08:21:32.038Z', - id: taskId, - lastHeartbeatAt: '2023-10-16T08:21:54.304Z', - spec: { - apiVersion: 'scaffolder.backstage.io/v1beta3', - steps: [ - { - action: 'fetch:template', - id: 'fetch', - }, - { - action: 'debug:wait', - id: 'mock-step-1', - }, - { - action: 'debug:wait', - id: 'mock-step-2', - }, - ], - templateInfo: { - entityRef: 'template:default/docs-long-running-template', - }, - }, - } as SerializedTask), - ); - }), - rest.get(`${mockBaseUrl}/v2/tasks/:taskId/events`, (_req, res, ctx) => { - return res( - ctx.json([ - { - createdAt: '2023-10-16T08:21:32.062Z', - body: {}, - id: 109, - taskId, - type: 'log', - }, - { - body: { stepId: 'fetch' }, - createdAt: '2023-10-16T08:21:32.062Z', - id: 110, - taskId, - type: 'log', - }, - { - body: { stepId: 'fetch' }, - createdAt: '2023-10-16T08:21:33.062Z', - id: 111, - taskId, - type: 'log', - }, - { - body: { stepId: 'fetch' }, - createdAt: '2023-10-16T08:21:34.062Z', - id: 112, - taskId, - type: 'log', - }, - { - body: { stepId: 'mock-step-1' }, - createdAt: '2023-10-16T08:21:37.062Z', - id: 120, - taskId, - type: 'log', - }, - ] as SerializedTaskEvent[]), - ); - }), - ); - - const task = await apiClient.getTask(taskId); - - const getStep = (stepId: string) => - task.spec.steps.find( - step => step.id === stepId, - ) as unknown as ScaffolderStep; - - expect(getStep('fetch').startedAt).toBe('2023-10-16T08:21:32.062Z'); - expect(getStep('fetch').endedAt).toBe('2023-10-16T08:21:34.062Z'); - expect(getStep('mock-step-1').startedAt).toBe('2023-10-16T08:21:37.062Z'); - expect(getStep('mock-step-1').endedAt).toBe('2023-10-16T08:21:37.062Z'); - expect(getStep('mock-step-2').startedAt).toBeUndefined(); - expect(getStep('mock-step-2').endedAt).toBeUndefined(); - }); - }); - describe('listTasks', () => { it('should list all tasks', async () => { server.use(