2021-08-04 22:23:57 +02:00
|
|
|
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';
|
2024-02-04 11:49:26 -04:00
|
|
|
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';
|
2021-08-04 22:23:57 +02:00
|
|
|
|
2023-03-04 13:51:11 -04:00
|
|
|
jest.mock('../../blue_modules/BlueElectrum', () => {
|
|
|
|
return {
|
|
|
|
connectMain: jest.fn(),
|
|
|
|
};
|
2021-08-04 22:23:57 +02:00
|
|
|
});
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
2023-07-25 14:50:04 +01:00
|
|
|
// 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;
|
2020-06-01 15:54:23 +03:00
|
|
|
const allTests = [];
|
2021-05-08 09:41:45 +03:00
|
|
|
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('; '));
|
|
|
|
});
|