From b78f623c858927526ce51cbf55395e2694f445e6 Mon Sep 17 00:00:00 2001 From: Spencer T Brody Date: Thu, 20 Jun 2024 15:59:16 -0400 Subject: [PATCH] fix test --- .../__tests__/request-controller.test.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/controllers/__tests__/request-controller.test.ts b/src/controllers/__tests__/request-controller.test.ts index 0d85cde9..0b8cffb8 100644 --- a/src/controllers/__tests__/request-controller.test.ts +++ b/src/controllers/__tests__/request-controller.test.ts @@ -212,7 +212,7 @@ describe('createRequest', () => { expect(createdRequest.origin).toEqual(origin) }) - test('timestamp is empty', async () => { + test('timestamp is required', async () => { const cid = randomCID() const streamId = randomStreamID() const now = new Date() @@ -229,17 +229,7 @@ describe('createRequest', () => { const requestRepository = container.resolve('requestRepository') await expect(requestRepository.findByCid(cid)).resolves.toBeUndefined() await controller.createRequest(req, res) - expect(res.status).toBeCalledWith(StatusCodes.CREATED) - const createdRequest = await requestRepository.findByCid(cid) - expectPresent(createdRequest) - expect(createdRequest.cid).toEqual(cid.toString()) - expect(createdRequest.status).toEqual(RequestStatus.PENDING) - expect(createdRequest.streamId).toEqual(streamId.toString()) - expect(createdRequest.message).toEqual('Request is pending.') - expect(isClose(createdRequest.timestamp.getTime(), now.getTime())).toBeTruthy() - expect(isClose(createdRequest.createdAt.getTime(), now.getTime())).toBeTruthy() - expect(isClose(createdRequest.updatedAt.getTime(), now.getTime())).toBeTruthy() - expect(createdRequest.origin).not.toBeNull() + expect(res.status).toBeCalledWith(StatusCodes.BAD_REQUEST) }) test('mark previous submissions REPLACED', async () => { @@ -249,6 +239,7 @@ describe('createRequest', () => { body: { cid: cid.toString(), streamId: streamId.toString(), + timestamp: new Date().toISOString(), }, }) const requestRepository = container.resolve('requestRepository') @@ -332,6 +323,7 @@ describe('createRequest', () => { body: { cid: cid.toString(), streamId: streamId.toString(), + timestamp: new Date().toISOString(), }, }) const validationQueueService = container.resolve('validationQueueService')