and index.jsx tests

This commit is contained in:
John Mitchell
2018-11-02 13:45:11 -04:00
parent 19dcf5ed59
commit 90d1ab88b1
2 changed files with 33 additions and 5 deletions

22
__tests__/index.test.jsx Normal file
View File

@@ -0,0 +1,22 @@
import React from 'react';
import ReactDOM from 'react-dom';
import api from '../src/api';
import indexToRender from '../src/index';
const custom_logo = (<div>logo</div>);
const custom_login_info = 'custom login info';
jest.mock('react-dom', () => ({ render: jest.fn() }));
describe('index.jsx', () => {
test('renders without crashing', async () => {
api.getRoot = jest.fn().mockImplementation(() => Promise
.resolve({ data: { custom_logo, custom_login_info } }));
await indexToRender();
expect(ReactDOM.render).toHaveBeenCalled();
});
});