From 5a564d1fdccb368e74fca24d6ebe05bcc0aa3b93 Mon Sep 17 00:00:00 2001 From: Ryan Ahearn Date: Tue, 2 Mar 2021 15:11:31 -0500 Subject: [PATCH] Update tests --- frontend/src/components/__tests__/FileUploader.js | 3 +-- package.json | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/__tests__/FileUploader.js b/frontend/src/components/__tests__/FileUploader.js index 1ec7ac1eee..481f47d26f 100644 --- a/frontend/src/components/__tests__/FileUploader.js +++ b/frontend/src/components/__tests__/FileUploader.js @@ -6,8 +6,6 @@ import { import * as fileFetcher from '../../fetchers/File'; import FileUploader, { getStatus, upload } from '../FileUploader'; -const mockFileUpload = jest.spyOn(fileFetcher, 'uploadFile').mockImplementation(async () => Promise.resolve({ id: 1 })); - describe('getStatus tests', () => { it('returns the correct statuses', () => { let newStatus; @@ -34,6 +32,7 @@ describe('upload tests', () => { const mockFile = { name: 'MockFile', size: 2000 }; const mockSetErrorMessage = jest.fn(); it('can upload a file and return the correct information', async () => { + const mockFileUpload = jest.spyOn(fileFetcher, 'uploadFile').mockImplementation(async () => ({ id: 1 })); const got = await upload(mockFile, 1, 'fakeAttachment', mockSetErrorMessage); expect(got).toStrictEqual({ id: 1, originalFileName: mockFile.name, fileSize: mockFile.size, status: 'UPLOADED', diff --git a/package.json b/package.json index a6c0c621b4..d1452a7175 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "server:debug": "nodemon src/index.js --exec babel-node --inspect", "client": "yarn --cwd frontend start", "test": "jest src --runInBand", - "test:ci": "cross-env JEST_JUNIT_OUTPUT_DIR=reports JEST_JUNIT_OUTPUT_NAME=unit.xml POSTGRES_USERNAME=postgres POSTGRES_DB=ttasmarthub CURRENT_USER_ID=5 CI=true jest src --coverage --reporters=default --reporters=jest-junit", + "test:ci": "cross-env JEST_JUNIT_OUTPUT_DIR=reports JEST_JUNIT_OUTPUT_NAME=unit.xml POSTGRES_USERNAME=postgres POSTGRES_DB=ttasmarthub CURRENT_USER_ID=5 CI=true jest src --coverage --reporters=default --reporters=jest-junit --forceExit", "test:all": "yarn test:ci && yarn --cwd frontend test:ci", "lint": "eslint src", "lint:ci": "eslint -f eslint-formatter-multiple src",