Skip to content

Commit

Permalink
lint SourceDownloadLink test
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnC-80 committed Oct 3, 2023
1 parent 0dce212 commit de4a09d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/routes/JobSummary/components/SourceDownloadLink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ import '../../../utils/multipartUpload';

// the indirectly used ky library extends JS Errors with JS mockHTTPError.
// this is used to simulate how we handle a 404 response.
class mockHTTPError extends Error {
constructor(response) {
super(
response.status
);
this.name = 'HTTPError';
this.response = response;
}
class MockHTTPError extends Error {
constructor(response) {
super(
response.status
);
this.name = 'HTTPError';
this.response = response;
}
}

const mockResponse = jest.fn();
jest.mock('../../../utils/multipartUpload', () => ({
...jest.requireActual('../../../utils/multipartUpload'),
getObjectStorageDownloadURL: (ky, id) => {
if (id === 'file-removed') {
throw (new mockHTTPError({ status: '404'}));
throw (new MockHTTPError({ status: '404' }));
}
return Promise.resolve(mockResponse())
return Promise.resolve(mockResponse());
}
}));

Expand Down

0 comments on commit de4a09d

Please sign in to comment.