TST: fix mocks

This commit is contained in:
Overtorment 2021-03-25 19:36:00 +00:00
parent b3507587af
commit d722f031f8
2 changed files with 9 additions and 7 deletions

View File

@ -13,6 +13,7 @@ import {
} from '../../class'; } from '../../class';
import WalletImport from '../../class/wallet-import'; import WalletImport from '../../class/wallet-import';
import React from 'react'; import React from 'react';
import Notifications from '../../blue_modules/notifications';
const assert = require('assert'); const assert = require('assert');
global.net = require('net'); // needed by Electrum client. For RN it is proviced in shim.js global.net = require('net'); // needed by Electrum client. For RN it is proviced in shim.js
global.tls = require('tls'); // needed by Electrum client. For RN it is proviced in shim.js global.tls = require('tls'); // needed by Electrum client. For RN it is proviced in shim.js
@ -33,6 +34,12 @@ React.useContext = jest.fn(() => {
}; };
}); });
jest.mock('../../blue_modules/notifications', () => {
return {
majorTomToGroundControl: jest.fn(),
};
});
jest.mock('../../blue_modules/prompt', () => { jest.mock('../../blue_modules/prompt', () => {
return jest.fn(() => { return jest.fn(() => {
return 'qwerty'; return 'qwerty';
@ -50,7 +57,8 @@ beforeAll(async () => {
// awaiting for Electrum to be connected. For RN Electrum would naturally connect // awaiting for Electrum to be connected. For RN Electrum would naturally connect
// while app starts up, but for tests we need to wait for it // while app starts up, but for tests we need to wait for it
await BlueElectrum.waitTillConnected(); await BlueElectrum.waitTillConnected();
WalletImport(); // wut WalletImport(); // damn i love javascript
Notifications(); // damn i love javascript
}); });
describe('import procedure', function () { describe('import procedure', function () {

View File

@ -128,10 +128,4 @@ jest.mock('../blue_modules/analytics', () => {
return ret; return ret;
}); });
jest.mock('../blue_modules/notifications', () => {
return {
majorTomToGroundControl: jest.fn(),
};
});
global.alert = () => {}; global.alert = () => {};