mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 01:40:12 +01:00
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
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(<Header />).toJSON();
|
|
expect(rendered).toBeTruthy();
|
|
});
|
|
|
|
// eslint-disable-next-line jest/no-disabled-tests
|
|
it.skip('Settings work', () => {
|
|
const rendered = TestRenderer.create(<Settings />).toJSON();
|
|
expect(rendered).toBeTruthy();
|
|
});
|
|
|
|
it('SelfTest work', () => {
|
|
const component = TestRenderer.create(<SelfTest />);
|
|
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('; '));
|
|
});
|