Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rahearn committed Mar 2, 2021
1 parent d5823eb commit 5a564d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions frontend/src/components/__tests__/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5a564d1

Please sign in to comment.