rename password with forgot-password

This commit is contained in:
Moriz Wahl 2022-03-07 19:07:14 +01:00
parent 14dcb3fa93
commit bcc3ca4907
10 changed files with 30 additions and 28 deletions

View File

@ -116,7 +116,7 @@ describe('ForgotPassword', () => {
await flushPromises()
})
it('pushes to "/thx/password"', () => {
it('pushes to "/thx/forgotPassword"', () => {
expect(mockAPIcall).toBeCalledWith(
expect.objectContaining({
variables: {
@ -124,7 +124,7 @@ describe('ForgotPassword', () => {
},
}),
)
expect(mockRouterPush).toHaveBeenCalledWith('/thx/password')
expect(mockRouterPush).toHaveBeenCalledWith('/thx/forgotPassword')
})
})
@ -141,7 +141,7 @@ describe('ForgotPassword', () => {
await flushPromises()
})
it('pushes to "/thx/password"', () => {
it('pushes to "/thx/forgotPassword"', () => {
expect(mockAPIcall).toBeCalledWith(
expect.objectContaining({
variables: {
@ -149,7 +149,7 @@ describe('ForgotPassword', () => {
},
}),
)
expect(mockRouterPush).toHaveBeenCalledWith('/thx/password')
expect(mockRouterPush).toHaveBeenCalledWith('/thx/forgotPassword')
})
})
})

View File

@ -57,7 +57,7 @@ const textFields = {
}
export default {
name: 'password',
name: 'ForgotPassword',
components: {
InputEmail,
},
@ -80,10 +80,10 @@ export default {
},
})
.then(() => {
this.$router.push('/thx/password')
this.$router.push('/thx/forgotPassword')
})
.catch(() => {
this.$router.push('/thx/password')
this.$router.push('/thx/forgotPassword')
})
},
},

View File

@ -136,8 +136,8 @@ describe('Login', () => {
)
})
it('links to /password when clicking "Forgot Password"', () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to).toBe('/password')
it('links to /forgot-password when clicking "Forgot Password"', () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to).toBe('/forgot-password')
})
it('has a link "Create new account"', () => {

View File

@ -44,7 +44,7 @@
</b-card>
<b-row class="mt-3">
<b-col cols="6" class="text-center text-sm-left col-12 col-sm-6 pb-5">
<router-link to="/password" class="mt-3">
<router-link to="/forgot-password" class="mt-3">
{{ $t('settings.password.forgot_pwd') }}
</router-link>
</b-col>

View File

@ -156,8 +156,8 @@ describe('ResetPassword', () => {
expect(toastErrorSpy).toHaveBeenCalledWith('...Code is older than 10 minutes')
})
it('router pushes to /password/reset', () => {
expect(routerPushMock).toHaveBeenCalledWith('/password/reset')
it('router pushes to /forgot-password/reset', () => {
expect(routerPushMock).toHaveBeenCalledWith('/forgot-password/reset')
})
})

View File

@ -101,7 +101,7 @@ export default {
.catch((error) => {
this.toastError(error.message)
if (error.message.includes('Code is older than 10 minutes'))
this.$router.push('/password/reset')
this.$router.push('/forgot-password/reset')
})
},
setDisplaySetup() {

View File

@ -23,7 +23,7 @@ describe('Thx', () => {
describe('mount', () => {
beforeEach(() => {
wrapper = Wrapper(createMockObject('password'))
wrapper = Wrapper(createMockObject('forgotPassword'))
})
it('renders the thx page', () => {
@ -35,9 +35,9 @@ describe('Thx', () => {
})
})
describe('coming from /password', () => {
describe('coming from /forgot-password', () => {
beforeEach(() => {
wrapper = Wrapper(createMockObject('password'))
wrapper = Wrapper(createMockObject('forgotPassword'))
})
it('renders the thanks text', () => {

View File

@ -18,7 +18,7 @@
</template>
<script>
const textFields = {
password: {
forgotPassword: {
headline: 'site.thx.title',
subtitle: 'site.thx.email',
button: 'login',

View File

@ -130,23 +130,25 @@ describe('router', () => {
it('enters the page when coming from a valid page', () => {
jest.resetAllMocks()
beforeEnter({}, { path: '/password' }, next)
beforeEnter({}, { path: '/forgot-password' }, next)
expect(next).toBeCalledWith()
})
})
})
describe('password', () => {
it('loads the "Password" component', async () => {
const component = await routes.find((r) => r.path === '/password').component()
expect(component.default.name).toBe('password')
describe('forgot password', () => {
it('loads the "ForgotPassword" component', async () => {
const component = await routes.find((r) => r.path === '/forgot-password').component()
expect(component.default.name).toBe('ForgotPassword')
})
})
describe('password with param comingFrom', () => {
it('loads the "Password" component', async () => {
const component = await routes.find((r) => r.path === '/password/:comingFrom').component()
expect(component.default.name).toBe('password')
it('loads the "ForgotPassword" component', async () => {
const component = await routes
.find((r) => r.path === '/forgot-password/:comingFrom')
.component()
expect(component.default.name).toBe('ForgotPassword')
})
})

View File

@ -50,7 +50,7 @@ const routes = [
path: '/thx/:comingFrom',
component: () => import('@/pages/thx.vue'),
beforeEnter: (to, from, next) => {
const validFrom = ['password', 'reset', 'register', 'login', 'checkEmail']
const validFrom = ['forgot-password', 'reset', 'register', 'login', 'checkEmail']
if (!validFrom.includes(from.path.split('/')[1])) {
next({ path: '/login' })
} else {
@ -59,11 +59,11 @@ const routes = [
},
},
{
path: '/password',
path: '/forgot-password',
component: () => import('@/pages/ForgotPassword.vue'),
},
{
path: '/password/:comingFrom',
path: '/forgot-password/:comingFrom',
component: () => import('@/pages/ForgotPassword.vue'),
},
{