1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/app/components/app/modals/confirm-reset-account/tests/confirm-reset-account.test.js

47 lines
1.1 KiB
JavaScript
Raw Normal View History

import assert from 'assert';
import React from 'react';
import sinon from 'sinon';
import { mount } from 'enzyme';
import ConfirmResetAccount from '..';
describe('Confirm Reset Account', function () {
let wrapper;
const props = {
hideModal: sinon.spy(),
resetAccount: sinon.stub().resolves(),
};
beforeEach(function () {
2020-11-03 00:41:28 +01:00
wrapper = mount(<ConfirmResetAccount.WrappedComponent {...props} />, {
context: {
t: (str) => str,
},
});
});
afterEach(function () {
props.hideModal.resetHistory();
});
it('hides modal when nevermind button is clicked', function () {
2020-11-03 00:41:28 +01:00
const nevermind = wrapper.find(
'.btn-default.modal-container__footer-button',
);
nevermind.simulate('click');
assert(props.hideModal.calledOnce);
});
2020-07-20 19:02:49 +02:00
it('resets account and hides modal when reset button is clicked', function (done) {
const reset = wrapper.find('.btn-danger.modal-container__footer-button');
reset.simulate('click');
setImmediate(() => {
assert(props.resetAccount.calledOnce);
assert(props.hideModal.calledOnce);
done();
});
});
});