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

43 lines
1.1 KiB
JavaScript
Raw Normal View History

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