mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
ForgotPassword logic change implemented in tests.
This commit is contained in:
parent
4b49d85d1a
commit
cee7c66a45
@ -8,30 +8,52 @@ const localVue = global.localVue
|
|||||||
|
|
||||||
const mockRouterPush = jest.fn()
|
const mockRouterPush = jest.fn()
|
||||||
|
|
||||||
|
|
||||||
|
const mocks = {
|
||||||
|
$t: jest.fn((t) => t),
|
||||||
|
$router: {
|
||||||
|
push: mockRouterPush,
|
||||||
|
},
|
||||||
|
$apollo: {
|
||||||
|
query: mockAPIcall,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const stubs = {
|
||||||
|
RouterLink: RouterLinkStub,
|
||||||
|
}
|
||||||
|
|
||||||
|
const createMockObject = (comingFrom) => {
|
||||||
|
return {
|
||||||
|
localVue,
|
||||||
|
mocks: {
|
||||||
|
$t: jest.fn((t) => t),
|
||||||
|
$router: {
|
||||||
|
push: mockRouterPush,
|
||||||
|
},
|
||||||
|
$apollo: {
|
||||||
|
query: mockAPIcall,
|
||||||
|
},
|
||||||
|
$route: {
|
||||||
|
params: {
|
||||||
|
comingFrom,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
stubs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
describe('ForgotPassword', () => {
|
describe('ForgotPassword', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
const mocks = {
|
const Wrapper = (functionN) => {
|
||||||
$t: jest.fn((t) => t),
|
return mount(ForgotPassword, functionN)
|
||||||
$router: {
|
|
||||||
push: mockRouterPush,
|
|
||||||
},
|
|
||||||
$apollo: {
|
|
||||||
query: mockAPIcall,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
const stubs = {
|
|
||||||
RouterLink: RouterLinkStub,
|
|
||||||
}
|
|
||||||
|
|
||||||
const Wrapper = () => {
|
|
||||||
return mount(ForgotPassword, { localVue, mocks, stubs })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper(createMockObject())
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders the component', () => {
|
it('renders the component', () => {
|
||||||
@ -144,5 +166,15 @@ describe('ForgotPassword', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('comingFrom login', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
wrapper = Wrapper(createMockObject('reset'))
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has another subtitle', () => {
|
||||||
|
expect(wrapper.find('p.text-lead').text()).toEqual('settings.password.resend_subtitle')
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user