Ocelot-Social/components/ChangePassword.spec.js
2019-03-22 15:53:01 +01:00

82 lines
1.8 KiB
JavaScript

import { shallowMount, createLocalVue } from '@vue/test-utils'
import ChangePassword from './ChangePassword.vue'
import Vue from 'vue'
import Styleguide from '@human-connection/styleguide'
const localVue = createLocalVue()
localVue.use(Styleguide)
describe('ChangePassword.vue', () => {
let store
let mocks
let wrapper
beforeEach(() => {
mocks = {
$apollo: {
mutate: jest.fn().mockResolvedValue()
}
}
})
describe('shallowMount', () => {
let wrapper
const Wrapper = () => {
return shallowMount(ChangePassword, { mocks, localVue })
}
beforeEach(() => {
wrapper = Wrapper()
})
it('renders', () => {
expect(wrapper.is('div')).toBe(true)
})
describe('validations', () => {
it('invalid', () => {
expect(wrapper.vm.disabled).toBe(true)
})
describe('old password and new password', () => {
describe('match', () => {
it.todo('invalid')
it.todo('displays a warning')
})
})
describe('new password and confirmation', () => {
describe('mismatch', () => {
it.todo('invalid')
it.todo('displays a warning')
})
describe('match', () => {
describe('and old password mismatch', () => {
it.todo('valid')
})
describe('clicked', () => {
it.todo('sets loading')
})
})
})
})
describe('given valid input', () => {
describe('click on submit button', () => {
it.todo('calls changePassword mutation')
describe('mutation resolves', () => {
it.todo('calls auth/SET_TOKEN with response')
})
describe('mutation rejects', () => {
it.todo('displays error message')
})
})
})
})
})