diff --git a/components/ChangePassword.spec.js b/components/ChangePassword.spec.js new file mode 100644 index 000000000..fda0e3f42 --- /dev/null +++ b/components/ChangePassword.spec.js @@ -0,0 +1,72 @@ +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', () => { + const Wrapper = () => { + return shallowMount(ChangePassword, { mocks, localVue }) + } + + it.todo('renders') + + describe('validations', () => { + it.todo('is disabled') + + 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') + }) + }) + }) + }) +}) diff --git a/components/ChangePassword.vue b/components/ChangePassword.vue new file mode 100644 index 000000000..6beff5199 --- /dev/null +++ b/components/ChangePassword.vue @@ -0,0 +1,2 @@ +