From de255ce27d7e49ea1e5ed4dafa62b490303b3994 Mon Sep 17 00:00:00 2001 From: Josh Salisbury Date: Thu, 11 Mar 2021 12:37:14 -0600 Subject: [PATCH] File upload test shouldn't error out FileId is now set in a before each and should no longer depend on tests being ran in a specific order --- src/routes/files/handlers.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/files/handlers.test.js b/src/routes/files/handlers.test.js index 1b8deb0bbf..9aec3dad6e 100644 --- a/src/routes/files/handlers.test.js +++ b/src/routes/files/handlers.test.js @@ -80,11 +80,9 @@ describe('File Upload', () => { }); describe('File Upload Handlers happy path', () => { - beforeEach(() => { + beforeEach(async () => { uploadFile.mockReset(); getPresignedURL.mockReset(); - }); - it('tests a file upload', async () => { ActivityReportPolicy.mockImplementation(() => ({ canUpdate: () => true, })); @@ -96,8 +94,10 @@ describe('File Upload', () => { .expect(200) .then((res) => { fileId = res.body.id; - expect(uploadFile).toHaveBeenCalled(); }); + }); + it('tests a file upload', async () => { + expect(uploadFile).toHaveBeenCalled(); expect(mockAddToScanQueue).toHaveBeenCalled(); }); it('checks the metadata was uploaded to the database', async () => {