import React from 'react'; import App from './App'; import {shallow} from 'enzyme'; describe('', function () { it('renders without crashing ', function () { const wrapper = shallow(); wrapper.unmount(); }); it('renders title', () => { const wrapper = shallow(); expect(wrapper.find('.navbrand').text()).toBe('OpenMediaCenter'); }); it('are navlinks correct', function () { const wrapper = shallow(); expect(wrapper.find('.navitem')).toHaveLength(4); }); it('test initial fetch from api', done => { global.fetch = global.prepareFetchApi({ generalSettingsLoaded: true, passwordsupport: true, mediacentername: 'testname' }); const wrapper = shallow(); const func = jest.fn(); wrapper.instance().setState = func; expect(global.fetch).toBeCalledTimes(1); process.nextTick(() => { expect(func).toBeCalledTimes(1); global.fetch.mockClear(); done(); }); }); });