Skip to content

Commit 09a5d9d

Browse files
authored
Merge pull request #16 from ml-tooling/bugfix/fix-frontend-test
Fix frontend test by mocking result of oauthEnabled call
2 parents 4c09d00 + 996265b commit 09a5d9d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

webapp/src/setupTests.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ import '@testing-library/jest-dom';
77
// add jest-canvas-mock to prevent a Not implemented error (see https://github.com/hustcc/jest-canvas-mock/issues/2)
88
import 'jest-canvas-mock';
99

10+
// Mocking authApi (needed to render App)
11+
import { authApi } from './services/contaxy-api';
12+
13+
jest.mock('./services/contaxy-api');
14+
15+
beforeEach(() => {
16+
authApi.oauthEnabled.mockResolvedValue({});
17+
});
18+
1019
// add mocks here that are needed for all tests as this file is automatically executed (see https://github.com/facebook/create-react-app/issues/9706)
1120
jest.mock('jdenticon', () => ({
1221
update: () => 'foo',

0 commit comments

Comments
 (0)