mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
coverage request.spec.js
This commit is contained in:
parent
f9d5ecec5b
commit
47813b9176
54
webapp/pages/password-reset/request.spec.js
Normal file
54
webapp/pages/password-reset/request.spec.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import { config, mount } from '@vue/test-utils'
|
||||||
|
import request from './request.vue'
|
||||||
|
|
||||||
|
const localVue = global.localVue
|
||||||
|
// config.stubs['sweetalert-icon'] = '<span><slot /></span>'
|
||||||
|
config.stubs['nuxt-link'] = '<span class="nuxt-link"><slot /></span>'
|
||||||
|
|
||||||
|
describe('request.vue', () => {
|
||||||
|
let wrapper
|
||||||
|
let mocks
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
mocks = {
|
||||||
|
/* $toast: {
|
||||||
|
success: jest.fn(),
|
||||||
|
error: jest.fn(),
|
||||||
|
}, */
|
||||||
|
$t: jest.fn(),
|
||||||
|
$apollo: {
|
||||||
|
loading: false,
|
||||||
|
// mutate: jest.fn().mockResolvedValue({ data: { reqestPasswordReset: true } }),
|
||||||
|
},
|
||||||
|
/* $router: {
|
||||||
|
push: jest.fn()
|
||||||
|
} */
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('mount', () => {
|
||||||
|
const Wrapper = () => {
|
||||||
|
return mount(request, { mocks, localVue })
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
wrapper = Wrapper()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders', () => {
|
||||||
|
expect(wrapper.findAll('.ds-form')).toHaveLength(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it.skip('calls "handlePasswordResetRequested" on submit', async () => {
|
||||||
|
await jest.useFakeTimers()
|
||||||
|
await wrapper.find('input#email').setValue('mail@example.org')
|
||||||
|
await wrapper.findAll('.ds-form').trigger('submit')
|
||||||
|
await jest.runAllTimers()
|
||||||
|
expect(wrapper.emitted('handleSubmitted')).toEqual([[{ email: 'mail@example.org' }]])
|
||||||
|
expect(mocks.$router.push).toHaveBeenCalledWith({
|
||||||
|
path: 'enter-nonce',
|
||||||
|
query: { email: 'mail@example.org' },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user