BlueWallet/tests/integration/App.test.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

import assert from 'assert';
2018-03-18 15:15:10 +00:00
import React from 'react';
2018-09-15 19:52:58 -04:00
import TestRenderer from 'react-test-renderer';
import Settings from '../../screen/settings/Settings';
2019-06-08 13:57:44 +01:00
import Selftest from '../../screen/selftest';
2022-01-28 14:13:53 +03:00
import { BlueHeaderDefaultSub } from '../../BlueComponents';
2023-03-04 13:51:11 -04:00
jest.mock('../../blue_modules/BlueElectrum', () => {
return {
connectMain: jest.fn(),
};
});
2022-01-28 14:13:53 +03:00
it('BlueHeaderDefaultSub works', () => {
const rendered = TestRenderer.create(<BlueHeaderDefaultSub />).toJSON();
2018-03-18 15:15:10 +00:00
expect(rendered).toBeTruthy();
});
// eslint-disable-next-line jest/no-disabled-tests
2019-03-31 02:15:02 +01:00
it.skip('Settings work', () => {
2018-09-15 19:52:58 -04:00
const rendered = TestRenderer.create(<Settings />).toJSON();
2018-03-18 15:15:10 +00:00
expect(rendered).toBeTruthy();
});
2018-03-24 20:12:59 +00:00
it('Selftest work', () => {
2018-09-15 19:52:58 -04:00
const component = TestRenderer.create(<Selftest />);
2018-03-24 20:12:59 +00:00
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')) {
2018-03-24 20:12:59 +00:00
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('; '));
});