ίϯϙʔωϯτͷςετͰͪΐͬͱࠔΔγʔϯᶃ
it('จࣈྻ͕ೖྗ͞ΕͨΒɺAPI͕1ճݺΕΔ', () => {
stub = sinon.stub(api, 'checkAccount')
const Constructor = Vue.extend(Event)
const vm = new Constructor().$mount()
const input = vm.$el.querySelector('input')
const event = document.createEvent('HTMLEvents')
event.initEvent('input', true, true)
input.dispatchEvent(event)
expect(stub.calledOnce).to.be.true
})
Account:
import api from '../libs/api'
export default {
data () {
return {
msg: ''
}
},
methods: {
checkAccount: () => {
api.checkAccount()
}
}
}
ίϯϙʔωϯτ ςετέʔε
จࣈྻೖྗ͞ΕͨΒ"1*ͰνΣοΫ͢Δ JOQVUΠϕϯτΛൃੜͤ͞Δͷ͕खؒɾɾɾ