diff --git a/src/pages/ManualInstall/ManualInstall.js b/src/pages/ManualInstall/ManualInstall.js index 437263f..f76dba3 100644 --- a/src/pages/ManualInstall/ManualInstall.js +++ b/src/pages/ManualInstall/ManualInstall.js @@ -43,10 +43,17 @@ const UploadButton = () => { setIsUploading(true) try { const response = await uploadApp(event.target.files[0]) - const body = await response.json() + + // using response.text() rather .json() to avoid breaking in { it('should allow navigating to the app', async () => { jest.spyOn(global, 'fetch').mockResolvedValueOnce({ - json: () => Promise.resolve({ app_hub_id: 'some_apphub_id' }), + text: () => + Promise.resolve( + JSON.stringify({ app_hub_id: 'some_apphub_id' }) + ), }) const { getByTestId, getByText, findByText } = renderWithProvider( @@ -57,7 +60,7 @@ describe('Manual Install', () => { it('should work with an empty response (pre v41)', async () => { jest.spyOn(global, 'fetch').mockResolvedValueOnce({ - json: () => Promise.resolve(), + text: () => null, }) const { getByTestId, findByText, queryByText } = renderWithProvider( @@ -73,11 +76,7 @@ describe('Manual Install', () => { }) it('should show an error if it fails', async () => { - jest.spyOn(global, 'fetch').mockResolvedValueOnce({ - json: () => { - throw 'upload failed' - }, - }) + jest.spyOn(global, 'fetch').mockRejectedValue('upload failed') const { getByTestId, findByText, queryByText } = renderWithProvider(