Add test for login form

This commit is contained in:
Phan An 2017-12-10 01:22:37 +01:00
parent 93f6050858
commit ec80ec49e9

View file

@ -0,0 +1,16 @@
import LoginForm from '@/components/auth/login-form.vue'
describe('components/auth/login-form', () => {
it('displays a form for users to log in', () => {
const wrapper = shallow(LoginForm)
expect(wrapper.findAll('form')).toHaveLength(1)
})
it('triggers login method when form is submitted', () => {
const spy = sinon.spy()
const wrapper = shallow(LoginForm)
wrapper.vm.login = spy
wrapper.find('form').trigger('submit')
expect(spy.called).toBe(true)
})
})