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 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', () => {
|
||||
let wrapper
|
||||
|
||||
const mocks = {
|
||||
$t: jest.fn((t) => t),
|
||||
$router: {
|
||||
push: mockRouterPush,
|
||||
},
|
||||
$apollo: {
|
||||
query: mockAPIcall,
|
||||
},
|
||||
}
|
||||
|
||||
const stubs = {
|
||||
RouterLink: RouterLinkStub,
|
||||
}
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(ForgotPassword, { localVue, mocks, stubs })
|
||||
const Wrapper = (functionN) => {
|
||||
return mount(ForgotPassword, functionN)
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
wrapper = Wrapper(createMockObject())
|
||||
})
|
||||
|
||||
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