import assert from 'assert'; import React from 'react'; import TestRenderer from 'react-test-renderer'; import { Header } from '../../components/Header'; import SelfTest from '../../screen/settings/SelfTest'; import Settings from '../../screen/settings/Settings'; jest.mock('../../blue_modules/BlueElectrum', () => { return { connectMain: jest.fn(), }; }); it('Header works', () => { const rendered = TestRenderer.create(
).toJSON(); expect(rendered).toBeTruthy(); }); // eslint-disable-next-line jest/no-disabled-tests it.skip('Settings work', () => { const rendered = TestRenderer.create().toJSON(); expect(rendered).toBeTruthy(); }); it('SelfTest work', () => { const component = TestRenderer.create(); const root = component.root; const rendered = component.toJSON(); expect(rendered).toBeTruthy(); // console.log((root.findAllByType('Text')[0].props)); let okFound = false; const allTests = []; for (const v of root.findAllByType('Text')) { let text = v.props.children; if (text.join) { text = text.join(''); } if (text === 'OK') { okFound = true; } allTests.push(text); // console.log(text); } assert.ok(okFound, 'OK not found. Got: ' + allTests.join('; ')); });