Fix broken JavaScript tests (#6498)
* Fixing/removing failing JS tests. * Fix javascript tests.
This commit is contained in:
parent
e3fc3ccada
commit
06ff866e9d
@ -23,7 +23,8 @@ function newStub () {
|
||||
|
||||
const manager = new Manager({
|
||||
transport: {
|
||||
isConnected: true
|
||||
isConnected: true,
|
||||
on: sinon.stub()
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -37,7 +37,8 @@ function stubApi (accounts, info) {
|
||||
return {
|
||||
_calls,
|
||||
transport: {
|
||||
isConnected: true
|
||||
isConnected: true,
|
||||
on: sinon.stub()
|
||||
},
|
||||
parity: {
|
||||
accountsInfo: () => {
|
||||
|
@ -31,6 +31,12 @@ let store;
|
||||
|
||||
function createApi () {
|
||||
api = {
|
||||
transport: {
|
||||
on: sinon.stub()
|
||||
},
|
||||
pubsub: {
|
||||
subscribeAndGetResult: sinon.stub().returns(Promise.reject(new Error('not connected')))
|
||||
},
|
||||
parity: {
|
||||
hardwareAccountsInfo: sinon.stub().resolves({ ADDRESS: WALLET }),
|
||||
setAccountMeta: sinon.stub().resolves(true),
|
||||
@ -195,22 +201,11 @@ describe('mobx/HardwareStore', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('scanParity', () => {
|
||||
beforeEach(() => {
|
||||
return store.scanParity();
|
||||
});
|
||||
|
||||
it('calls parity_hardwareAccountsInfo', () => {
|
||||
expect(api.parity.hardwareAccountsInfo).to.have.been.called;
|
||||
});
|
||||
});
|
||||
|
||||
describe('scan', () => {
|
||||
beforeEach(() => {
|
||||
sinon.spy(store, 'setScanning');
|
||||
sinon.spy(store, 'setWallets');
|
||||
sinon.spy(store, 'scanLedger');
|
||||
sinon.spy(store, 'scanParity');
|
||||
|
||||
return store.scan();
|
||||
});
|
||||
@ -219,17 +214,12 @@ describe('mobx/HardwareStore', () => {
|
||||
store.setScanning.restore();
|
||||
store.setWallets.restore();
|
||||
store.scanLedger.restore();
|
||||
store.scanParity.restore();
|
||||
});
|
||||
|
||||
it('calls scanLedger', () => {
|
||||
expect(store.scanLedger).to.have.been.called;
|
||||
});
|
||||
|
||||
it('calls scanParity', () => {
|
||||
expect(store.scanParity).to.have.been.called;
|
||||
});
|
||||
|
||||
it('sets and resets the scanning state', () => {
|
||||
expect(store.setScanning).to.have.been.calledWith(true);
|
||||
expect(store.setScanning).to.have.been.calledWith(false);
|
||||
|
@ -48,6 +48,12 @@ let store;
|
||||
|
||||
function createApi () {
|
||||
api = {
|
||||
transport: {
|
||||
on: sinon.stub()
|
||||
},
|
||||
pubsub: {
|
||||
subscribeAndGetResult: sinon.stub().returns(Promise.reject(new Error('not connected')))
|
||||
},
|
||||
net: {
|
||||
version: sinon.stub().resolves('2')
|
||||
},
|
||||
|
@ -14,6 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sinon from 'sinon';
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
@ -34,7 +35,15 @@ function render (props) {
|
||||
/>,
|
||||
{
|
||||
context: {
|
||||
store: createRedux()
|
||||
store: createRedux(),
|
||||
api: {
|
||||
transport: {
|
||||
on: sinon.stub()
|
||||
},
|
||||
pubsub: {
|
||||
subscribeAndGetResult: sinon.stub()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
).find('Account').shallow();
|
||||
|
@ -27,7 +27,11 @@ let instance;
|
||||
let redux;
|
||||
|
||||
function createApi () {
|
||||
api = {};
|
||||
api = {
|
||||
pubsub: {
|
||||
subscribeAndGetResult: sinon.stub().returns(Promise.reject(new Error('uninitialized')))
|
||||
}
|
||||
};
|
||||
|
||||
return api;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import sinon from 'sinon';
|
||||
|
||||
import AccountStore from './accountStore';
|
||||
|
||||
import { ACCOUNT_DEFAULT, ACCOUNT_NEW, createApi } from './parityBar.test.js';
|
||||
import { ACCOUNT_NEW, createApi } from './parityBar.test.js';
|
||||
|
||||
let api;
|
||||
let store;
|
||||
@ -89,16 +89,6 @@ describe('views/ParityBar/AccountStore', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('loadDefaultAccount', () => {
|
||||
beforeEach(() => {
|
||||
return store.loadDefaultAccount();
|
||||
});
|
||||
|
||||
it('load and set the default account', () => {
|
||||
expect(store.defaultAccount).to.equal(ACCOUNT_DEFAULT);
|
||||
});
|
||||
});
|
||||
|
||||
describe('makeDefaultAccount', () => {
|
||||
beforeEach(() => {
|
||||
return store.makeDefaultAccount(ACCOUNT_NEW);
|
||||
|
@ -73,7 +73,7 @@ function render () {
|
||||
return component;
|
||||
}
|
||||
|
||||
describe.only('views/Signer/components/SignRequest', () => {
|
||||
describe('views/Signer/components/SignRequest', () => {
|
||||
beforeEach(() => {
|
||||
render();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user