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 React from 'react'
import assert from 'assert'
import sinon from 'sinon'
import { mount } from 'enzyme'
import ConfirmResetAccount from '../index'
describe('Confirm Reset Account', function () {
let wrapper
const props = {
hideModal: sinon.spy(),
resetAccount: sinon.stub().resolves(),
}
beforeEach(function () {
wrapper = mount(
<ConfirmResetAccount.WrappedComponent {...props} />, {
context: {
2020-02-15 21:34:12 +01:00
t: (str) => str,
},
},
)
})
afterEach(function () {
props.hideModal.resetHistory()
})
it('hides modal when nevermind button is clicked', function () {
const nevermind = wrapper.find('.btn-default.modal-container__footer-button')
nevermind.simulate('click')
assert(props.hideModal.calledOnce)
})
it('resets account and hidels 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()
})
})
})