BlueWallet/tests/integration/App.test.js
Marcos Rodriguez Velez 5531f1d8a5
Update App.test.js
2024-06-07 23:54:14 -04:00

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('; '));
});