Merge branch 'master' into refactor-backend-relative-paths

This commit is contained in:
Moriz Wahl 2022-03-08 14:06:52 +01:00 committed by GitHub
commit 982be8d1ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 257 additions and 243 deletions

View File

@ -65,7 +65,8 @@ const email = {
EMAIL_SMTP_PORT: process.env.EMAIL_SMTP_PORT || '587',
EMAIL_LINK_VERIFICATION:
process.env.EMAIL_LINK_VERIFICATION || 'http://localhost/checkEmail/{code}',
EMAIL_LINK_SETPASSWORD: process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset/{code}',
EMAIL_LINK_SETPASSWORD:
process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset-password/{code}',
RESEND_TIME: isNaN(resendTime) ? 10 : resendTime,
}

View File

@ -12,6 +12,7 @@ module.exports = {
'\\.(css|less)$': 'identity-obj-proxy',
'\\.(scss)$': '<rootDir>/src/assets/mocks/styleMock.js',
'^@/(.*)$': '<rootDir>/src/$1',
'^@test/(.*)$': '<rootDir>/test/$1',
},
transform: {
'^.+\\.vue$': 'vue-jest',

View File

@ -10,8 +10,8 @@
<script>
import { ParticlesBg } from 'particles-bg-vue'
import icon from './icon.js'
import DashboardLayout from '@/views/Layout/DashboardLayout_gdd.vue'
import AuthLayoutGDD from '@/views/Layout/AuthLayout_gdd.vue'
import DashboardLayout from '@/layouts/DashboardLayout_gdd.vue'
import AuthLayoutGDD from '@/layouts/AuthLayout_gdd.vue'
export default {
name: 'app',

View File

@ -57,12 +57,12 @@
</template>
<script>
import TransactionListItem from '../../../components/TransactionListItem'
import PaginationButtons from '../../../components/PaginationButtons'
import TransactionDecay from '../../../components/Transactions/TransactionDecay'
import TransactionSend from '../../../components/Transactions/TransactionSend'
import TransactionReceive from '../../../components/Transactions/TransactionReceive'
import TransactionCreation from '../../../components/Transactions/TransactionCreation'
import TransactionListItem from '@/components/TransactionListItem'
import PaginationButtons from '@/components/PaginationButtons'
import TransactionDecay from '@/components/Transactions/TransactionDecay'
import TransactionSend from '@/components/Transactions/TransactionSend'
import TransactionReceive from '@/components/Transactions/TransactionReceive'
import TransactionCreation from '@/components/Transactions/TransactionCreation'
export default {
name: 'gdd-transaction-list',

View File

@ -1,8 +1,8 @@
import { mount } from '@vue/test-utils'
import { GdtEntryType } from '../../../graphql/enums'
import { GdtEntryType } from '@/graphql/enums'
import GdtTransactionList from './GdtTransactionList'
import { toastErrorSpy } from '../../../../test/testSetup'
import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue

View File

@ -36,9 +36,9 @@
</template>
<script>
import { listGDTEntriesQuery } from '../../../graphql/queries'
import PaginationButtons from '../../../components/PaginationButtons'
import Transaction from '../../../components/Transaction.vue'
import { listGDTEntriesQuery } from '@/graphql/queries'
import PaginationButtons from '@/components/PaginationButtons'
import Transaction from '@/components/Transaction.vue'
export default {
name: 'gdt-transaction-list',

View File

@ -4,7 +4,7 @@ import InputPasswordConfirmation from './InputPasswordConfirmation'
const localVue = global.localVue
// validation is tested in src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js
// validation is tested in src/components/UserSettings/UserPassword.spec.js
describe('InputPasswordConfirmation', () => {
let wrapper

View File

@ -12,8 +12,8 @@
</div>
</template>
<script>
import locales from '../locales/'
import { updateUserInfos } from '../graphql/mutations'
import locales from '@/locales/'
import { updateUserInfos } from '@/graphql/mutations'
export default {
name: 'LanguageSwitch',

View File

@ -32,7 +32,7 @@
</b-card>
</template>
<script>
import { updateUserInfos } from '../../../graphql/mutations'
import { updateUserInfos } from '@/graphql/mutations'
export default {
name: 'FormUserMail',

View File

@ -1,8 +1,8 @@
import { mount } from '@vue/test-utils'
import UserCardCoinAnimation from './UserCard_CoinAnimation'
import { updateUserInfos } from '../../../graphql/mutations'
import UserCoinAnimation from './UserCoinAnimation'
import { updateUserInfos } from '@/graphql/mutations'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup'
const localVue = global.localVue
@ -28,7 +28,7 @@ describe('UserCard_CoinAnimation', () => {
}
const Wrapper = () => {
return mount(UserCardCoinAnimation, { localVue, mocks })
return mount(UserCoinAnimation, { localVue, mocks })
}
describe('mount', () => {

View File

@ -31,9 +31,9 @@
</b-card>
</template>
<script>
import { updateUserInfos } from '../../../graphql/mutations'
import { updateUserInfos } from '@/graphql/mutations'
export default {
name: 'FormUserCoinAnimation',
name: 'UserCoinAnimation',
data() {
return {
CoinAnimationStatus: this.$store.state.coinanimation,

View File

@ -1,8 +1,8 @@
import { mount } from '@vue/test-utils'
import UserCardFormUserData from './UserCard_FormUserData'
import UserData from './UserData'
import flushPromises from 'flush-promises'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup'
const localVue = global.localVue
@ -28,7 +28,7 @@ describe('UserCard_FormUserData', () => {
}
const Wrapper = () => {
return mount(UserCardFormUserData, { localVue, mocks })
return mount(UserData, { localVue, mocks })
}
describe('mount', () => {

View File

@ -64,10 +64,10 @@
</b-card>
</template>
<script>
import { updateUserInfos } from '../../../graphql/mutations'
import { updateUserInfos } from '@/graphql/mutations'
export default {
name: 'FormUserData',
name: 'UserData',
data() {
return {
showUserData: true,

View File

@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import UserCardLanguage from './UserCard_Language'
import UserLanguage from './UserLanguage'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup'
const localVue = global.localVue
@ -35,7 +35,7 @@ describe('UserCard_Language', () => {
}
const Wrapper = () => {
return mount(UserCardLanguage, { localVue, mocks })
return mount(UserLanguage, { localVue, mocks })
}
describe('mount', () => {

View File

@ -60,11 +60,11 @@
</b-card>
</template>
<script>
import LanguageSwitchSelect from '../../../components/LanguageSwitchSelect.vue'
import { updateUserInfos } from '../../../graphql/mutations'
import LanguageSwitchSelect from '@/components/LanguageSwitchSelect.vue'
import { updateUserInfos } from '@/graphql/mutations'
export default {
name: 'FormUserLanguage',
name: 'UserLanguage',
components: { LanguageSwitchSelect },
data() {
return {

View File

@ -1,8 +1,8 @@
import { mount } from '@vue/test-utils'
import UserCardNewsletter from './UserCard_Newsletter'
import { unsubscribeNewsletter, subscribeNewsletter } from '../../../graphql/mutations'
import UserNewsletter from './UserNewsletter'
import { unsubscribeNewsletter, subscribeNewsletter } from '@/graphql/mutations'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup'
const localVue = global.localVue
@ -29,7 +29,7 @@ describe('UserCard_Newsletter', () => {
}
const Wrapper = () => {
return mount(UserCardNewsletter, { localVue, mocks })
return mount(UserNewsletter, { localVue, mocks })
}
describe('mount', () => {

View File

@ -27,10 +27,10 @@
</b-card>
</template>
<script>
import { subscribeNewsletter, unsubscribeNewsletter } from '../../../graphql/mutations'
import { subscribeNewsletter, unsubscribeNewsletter } from '@/graphql/mutations'
export default {
name: 'FormUserNewsletter',
name: 'UserNewsletter',
data() {
return {
newsletterState: this.$store.state.newsletterState,

View File

@ -1,8 +1,8 @@
import { mount } from '@vue/test-utils'
import UserCardFormPasswort from './UserCard_FormUserPasswort'
import UserPassword from './UserPassword'
import flushPromises from 'flush-promises'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup'
const localVue = global.localVue
@ -20,7 +20,7 @@ describe('UserCard_FormUserPasswort', () => {
}
const Wrapper = () => {
return mount(UserCardFormPasswort, { localVue, mocks })
return mount(UserPassword, { localVue, mocks })
}
describe('mount', () => {

View File

@ -48,12 +48,12 @@
</b-card>
</template>
<script>
import InputPassword from '../../../components/Inputs/InputPassword'
import InputPasswordConfirmation from '../../../components/Inputs/InputPasswordConfirmation'
import { updateUserInfos } from '../../../graphql/mutations'
import InputPassword from '@/components/Inputs/InputPassword'
import InputPasswordConfirmation from '@/components/Inputs/InputPasswordConfirmation'
import { updateUserInfos } from '@/graphql/mutations'
export default {
name: 'FormUserPasswort',
name: 'UserPassword',
components: {
InputPassword,
InputPasswordConfirmation,

View File

@ -59,7 +59,7 @@
</footer>
</template>
<script>
import CONFIG from '../../config'
import CONFIG from '@/config'
export default {
data() {

View File

@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import DashboardLayoutGdd from './DashboardLayout_gdd'
import { toastErrorSpy } from '../../../test/testSetup'
import { toastErrorSpy } from '@test/testSetup'
jest.useFakeTimers()

View File

@ -37,12 +37,12 @@
</div>
</template>
<script>
import Navbar from '../../components/Menu/Navbar.vue'
import Sidebar from '../../components/Menu/Sidebar.vue'
import { logout, transactionsQuery } from '../../graphql/queries'
import Navbar from '@/components/Menu/Navbar.vue'
import Sidebar from '@/components/Menu/Sidebar.vue'
import { logout, transactionsQuery } from '@/graphql/queries'
import ContentFooter from './ContentFooter.vue'
import { FadeTransition } from 'vue2-transitions'
import CONFIG from '../../config'
import CONFIG from '@/config'
export default {
components: {

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')
})
})
})
@ -158,7 +158,7 @@ describe('ForgotPassword', () => {
describe('comingFrom login', () => {
beforeEach(() => {
wrapper = Wrapper(createMockObject('reset'))
wrapper = Wrapper(createMockObject('resetPassword'))
})
it('has another subtitle', () => {

View File

@ -38,11 +38,11 @@
</div>
</template>
<script>
import { sendResetPasswordEmail } from '../../graphql/queries'
import InputEmail from '../../components/Inputs/InputEmail'
import { sendResetPasswordEmail } from '@/graphql/queries'
import InputEmail from '@/components/Inputs/InputEmail'
const textFields = {
reset: {
resetPassword: {
headline: 'settings.password.reset',
subtitle: 'settings.password.resend_subtitle',
button: 'settings.password.send_now',
@ -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

@ -2,7 +2,7 @@ import { RouterLinkStub, mount } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import Login from './Login'
import { toastErrorSpy } from '../../../test/testSetup'
import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue
@ -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"', () => {
@ -281,8 +281,8 @@ describe('Login', () => {
await flushPromises()
})
it('redirects to /reset/login', () => {
expect(mockRouterPush).toBeCalledWith('/reset/login')
it('redirects to /reset-password/login', () => {
expect(mockRouterPush).toBeCalledWith('/reset-password/login')
})
})
})

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>
@ -60,13 +60,13 @@
</div>
</template>
<script>
import InputPassword from '../../components/Inputs/InputPassword'
import InputEmail from '../../components/Inputs/InputEmail'
import { login } from '../../graphql/queries'
import { getCommunityInfoMixin } from '../../mixins/getCommunityInfo'
import InputPassword from '@/components/Inputs/InputPassword'
import InputEmail from '@/components/Inputs/InputEmail'
import { login } from '@/graphql/queries'
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
export default {
name: 'login',
name: 'Login',
components: {
InputPassword,
InputEmail,
@ -109,7 +109,7 @@ export default {
if (error.message.includes('User email not validated')) {
this.$router.push('/thx/login')
} else if (error.message.includes('User has no password set yet')) {
this.$router.push('/reset/login')
this.$router.push('/reset-password/login')
}
loader.hide()
})

View File

@ -1,11 +1,11 @@
import { mount } from '@vue/test-utils'
import AccountOverview from './AccountOverview'
import Overview from './Overview'
const localVue = global.localVue
window.scrollTo = jest.fn()
describe('AccountOverview', () => {
describe('Overview', () => {
let wrapper
const mocks = {
@ -14,7 +14,7 @@ describe('AccountOverview', () => {
}
const Wrapper = () => {
return mount(AccountOverview, {
return mount(Overview, {
localVue,
mocks,
})

View File

@ -27,9 +27,9 @@
</div>
</template>
<script>
import Status from '../../components/Status.vue'
import GddTransactionList from './AccountOverview/GddTransactionList.vue'
import GddTransactionListFooter from './AccountOverview/GddTransactionListFooter.vue'
import Status from '@/components/Status.vue'
import GddTransactionList from '@/components/GddTransactionList.vue'
import GddTransactionListFooter from '@/components/GddTransactionListFooter.vue'
export default {
name: 'Overview',

View File

@ -0,0 +1,46 @@
import { shallowMount } from '@vue/test-utils'
import Profile from './Profile'
const localVue = global.localVue
describe('Profile', () => {
let wrapper
const mocks = {
$t: jest.fn((t) => t),
}
const Wrapper = () => {
return shallowMount(Profile, { localVue, mocks })
}
describe('shallow Mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('has a user card', () => {
expect(wrapper.findComponent({ name: 'UserCard' }).exists()).toBeTruthy()
})
it('has a user first and last name form', () => {
expect(wrapper.findComponent({ name: 'UserData' }).exists()).toBeTruthy()
})
it('has a user change language form', () => {
expect(wrapper.findComponent({ name: 'UserLanguage' }).exists()).toBeTruthy()
})
it('has a user change password form', () => {
expect(wrapper.findComponent({ name: 'UserPassword' }).exists()).toBeTruthy()
})
it('has a user change newsletter form', () => {
expect(wrapper.findComponent({ name: 'UserNewsletter' }).exists()).toBeTruthy()
})
it('has a user change coin animation form', () => {
expect(wrapper.findComponent({ name: 'UserCoinAnimation' }).exists()).toBeTruthy()
})
})
})

View File

@ -1,34 +1,34 @@
<template>
<div fluid="sm" class="mr-2">
<user-card :balance="balance" :transactionCount="transactionCount"></user-card>
<form-user-data />
<user-data />
<hr />
<form-user-passwort />
<user-password />
<hr />
<form-user-language />
<user-language />
<hr />
<form-user-newsletter />
<user-newsletter />
<hr />
<form-user-coin-animation />
<user-coin-animation />
</div>
</template>
<script>
import UserCard from './UserProfile/UserCard.vue'
import FormUserData from './UserProfile/UserCard_FormUserData.vue'
import FormUserPasswort from './UserProfile/UserCard_FormUserPasswort.vue'
import FormUserLanguage from './UserProfile/UserCard_Language.vue'
import FormUserNewsletter from './UserProfile/UserCard_Newsletter.vue'
import FormUserCoinAnimation from './UserProfile/UserCard_CoinAnimation.vue'
import UserCard from '@/components/UserCard.vue'
import UserData from '@/components/UserSettings/UserData.vue'
import UserPassword from '@/components/UserSettings/UserPassword.vue'
import UserLanguage from '@/components/UserSettings/UserLanguage.vue'
import UserNewsletter from '@/components/UserSettings/UserNewsletter.vue'
import UserCoinAnimation from '@/components/UserSettings/UserCoinAnimation.vue'
export default {
name: 'UserProfile',
name: 'Profile',
components: {
UserCard,
FormUserData,
FormUserPasswort,
FormUserLanguage,
FormUserNewsletter,
FormUserCoinAnimation,
UserData,
UserPassword,
UserLanguage,
UserNewsletter,
UserCoinAnimation,
},
props: {
balance: { type: Number, default: 0 },

View File

@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import Register from './Register'
import { toastErrorSpy } from '../../../test/testSetup'
import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue

View File

@ -188,14 +188,14 @@
</div>
</template>
<script>
import InputEmail from '../../components/Inputs/InputEmail.vue'
import LanguageSwitchSelect from '../../components/LanguageSwitchSelect.vue'
import { createUser } from '../../graphql/mutations'
import { getCommunityInfoMixin } from '../../mixins/getCommunityInfo'
import InputEmail from '@/components/Inputs/InputEmail.vue'
import LanguageSwitchSelect from '@/components/LanguageSwitchSelect.vue'
import { createUser } from '@/graphql/mutations'
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
export default {
components: { InputEmail, LanguageSwitchSelect },
name: 'register',
name: 'Register',
mixins: [getCommunityInfoMixin],
data() {
return {

View File

@ -1,7 +1,7 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import RegisterCommunity from './RegisterCommunity'
import { toastErrorSpy } from '../../../test/testSetup'
import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue

View File

@ -49,10 +49,10 @@
</div>
</template>
<script>
import { getCommunityInfoMixin } from '../../mixins/getCommunityInfo'
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
export default {
name: 'registerCommunity',
name: 'RegisterCommunity',
mixins: [getCommunityInfoMixin],
}
</script>

View File

@ -2,9 +2,9 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import ResetPassword from './ResetPassword'
import flushPromises from 'flush-promises'
import { toastErrorSpy } from '../../../test/testSetup'
import { toastErrorSpy } from '@test/testSetup'
// validation is tested in src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js
// validation is tested in src/components/UserSettings/UserPassword.spec.js
const localVue = global.localVue
@ -78,7 +78,7 @@ describe('ResetPassword', () => {
describe('Register header', () => {
describe('from reset', () => {
beforeEach(() => {
mocks.$route.path.mock = 'reset'
mocks.$route.path.mock = 'reset-password'
wrapper = Wrapper()
})
@ -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/resetPassword', () => {
expect(routerPushMock).toHaveBeenCalledWith('/forgot-password/resetPassword')
})
})
@ -204,9 +204,9 @@ describe('ResetPassword', () => {
})
})
describe('server response with success on /reset', () => {
describe('server response with success on /reset-password', () => {
beforeEach(async () => {
mocks.$route.path.mock = 'reset'
mocks.$route.path.mock = 'reset-password'
wrapper = Wrapper()
apolloMutationMock.mockResolvedValue({
data: {
@ -219,8 +219,8 @@ describe('ResetPassword', () => {
await flushPromises()
})
it('redirects to "/thx/reset"', () => {
expect(routerPushMock).toHaveBeenCalledWith('/thx/reset')
it('redirects to "/thx/resetPassword"', () => {
expect(routerPushMock).toHaveBeenCalledWith('/thx/resetPassword')
})
})
})

View File

@ -44,8 +44,8 @@
</div>
</template>
<script>
import InputPasswordConfirmation from '../../components/Inputs/InputPasswordConfirmation'
import { setPassword } from '../../graphql/mutations'
import InputPasswordConfirmation from '@/components/Inputs/InputPasswordConfirmation'
import { setPassword } from '@/graphql/mutations'
const textFields = {
reset: {
@ -95,20 +95,20 @@ export default {
if (this.$route.path.includes('checkEmail')) {
this.$router.push('/thx/checkEmail')
} else {
this.$router.push('/thx/reset')
this.$router.push('/thx/resetPassword')
}
})
.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/resetPassword')
})
},
setDisplaySetup() {
if (this.$route.path.includes('checkEmail')) {
this.displaySetup = textFields.checkEmail
}
if (this.$route.path.includes('reset')) {
if (this.$route.path.includes('reset-password')) {
this.displaySetup = textFields.reset
}
},

View File

@ -1,8 +1,8 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import { communities, communityInfo } from '../../graphql/queries'
import RegisterSelectCommunity from './RegisterSelectCommunity'
import { communities, communityInfo } from '@/graphql/queries'
import SelectCommunity from './SelectCommunity'
import { toastErrorSpy } from '../../../test/testSetup'
import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue
@ -56,7 +56,7 @@ const apolloQueryMock = jest
const mockStoreCommit = jest.fn()
describe('RegisterSelectCommunity', () => {
describe('SelectCommunity', () => {
let wrapper
const mocks = {
@ -86,7 +86,7 @@ describe('RegisterSelectCommunity', () => {
}
const Wrapper = () => {
return mount(RegisterSelectCommunity, { localVue, mocks, stubs })
return mount(SelectCommunity, { localVue, mocks, stubs })
}
describe('mount', () => {

View File

@ -48,11 +48,11 @@
</div>
</template>
<script>
import { communities } from '../../graphql/queries'
import { getCommunityInfoMixin } from '../../mixins/getCommunityInfo'
import { communities } from '@/graphql/queries'
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
export default {
name: 'registerSelectCommunity',
name: 'SelectCommunity',
data() {
return {
communities: [],

View File

@ -1,5 +1,5 @@
import { mount } from '@vue/test-utils'
import SendOverview from './SendOverview'
import Send from './Send'
const sendMock = jest.fn()
sendMock.mockResolvedValue('success')
@ -8,7 +8,7 @@ const localVue = global.localVue
// window.scrollTo = jest.fn()
describe('SendOverview', () => {
describe('Send', () => {
let wrapper
const propsData = {
@ -32,7 +32,7 @@ describe('SendOverview', () => {
}
const Wrapper = () => {
return mount(SendOverview, { localVue, mocks, propsData })
return mount(Send, { localVue, mocks, propsData })
}
describe('mount', () => {

View File

@ -30,11 +30,11 @@
</div>
</template>
<script>
import GddSend from './SendOverview/GddSend.vue'
import TransactionForm from './SendOverview/GddSend/TransactionForm.vue'
import TransactionConfirmation from './SendOverview/GddSend/TransactionConfirmation.vue'
import TransactionResult from './SendOverview/GddSend/TransactionResult.vue'
import { sendCoins } from '../../graphql/mutations.js'
import GddSend from '@/components/GddSend.vue'
import TransactionForm from '@/components/GddSend/TransactionForm.vue'
import TransactionConfirmation from '@/components/GddSend/TransactionConfirmation.vue'
import TransactionResult from '@/components/GddSend/TransactionResult.vue'
import { sendCoins } from '@/graphql/mutations.js'
const EMPTY_TRANSACTION_DATA = {
email: '',
@ -43,7 +43,7 @@ const EMPTY_TRANSACTION_DATA = {
}
export default {
name: 'SendOverview',
name: 'Send',
components: {
GddSend,
TransactionForm,

View File

@ -1,11 +1,11 @@
import { mount } from '@vue/test-utils'
import UserProfileTransactionList from './UserProfileTransactionList'
import Transactions from './Transactions'
const localVue = global.localVue
window.scrollTo = jest.fn()
describe('UserProfileTransactionList', () => {
describe('Transactions', () => {
let wrapper
const mocks = {
@ -22,7 +22,7 @@ describe('UserProfileTransactionList', () => {
}
const Wrapper = () => {
return mount(UserProfileTransactionList, { localVue, mocks, stubs })
return mount(Transactions, { localVue, mocks, stubs })
}
describe('mount', () => {

View File

@ -26,11 +26,11 @@
</div>
</template>
<script>
import GddTransactionList from './AccountOverview/GddTransactionList.vue'
import GdtTransactionList from './AccountOverview/GdtTransactionList.vue'
import GddTransactionList from '@/components/GddTransactionList.vue'
import GdtTransactionList from '@/components/GdtTransactionList.vue'
export default {
name: 'UserProfileTransactionList',
name: 'Transactions',
components: {
GddTransactionList,
GdtTransactionList,

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', () => {
@ -53,9 +53,9 @@ describe('Thx', () => {
})
})
describe('coming from /reset', () => {
describe('coming from /reset-password', () => {
beforeEach(() => {
wrapper = Wrapper(createMockObject('reset'))
wrapper = Wrapper(createMockObject('resetPassword'))
})
it('renders the thanks text', () => {

View File

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

View File

@ -41,7 +41,7 @@ describe('navigation guards', () => {
})
it('does not commit the pid when not present', async () => {
await router.push({ path: 'password' })
await router.push({ path: 'forgot-password' })
expect(storeCommitMock).not.toBeCalled()
})
})

View File

@ -1,5 +1,5 @@
import router from './router'
import NotFound from '@/views/NotFoundPage.vue'
import NotFound from '@/pages/NotFoundPage.vue'
describe('router', () => {
describe('options', () => {
@ -58,7 +58,7 @@ describe('router', () => {
expect(routes.find((r) => r.path === '/overview').meta.requiresAuth).toBeTruthy()
})
it('loads the "Overview" component', async () => {
it('loads the "Overview" page', async () => {
const component = await routes.find((r) => r.path === '/overview').component()
expect(component.default.name).toBe('Overview')
})
@ -69,9 +69,9 @@ describe('router', () => {
expect(routes.find((r) => r.path === '/send').meta.requiresAuth).toBeTruthy()
})
it('loads the "Send" component', async () => {
it('loads the "Send" page', async () => {
const component = await routes.find((r) => r.path === '/send').component()
expect(component.default.name).toBe('SendOverview')
expect(component.default.name).toBe('Send')
})
})
@ -80,9 +80,9 @@ describe('router', () => {
expect(routes.find((r) => r.path === '/profile').meta.requiresAuth).toBeTruthy()
})
it('loads the "UserProfile" component', async () => {
it('loads the "Profile" page', async () => {
const component = await routes.find((r) => r.path === '/profile').component()
expect(component.default.name).toBe('UserProfile')
expect(component.default.name).toBe('Profile')
})
})
@ -91,30 +91,30 @@ describe('router', () => {
expect(routes.find((r) => r.path === '/transactions').meta.requiresAuth).toBeTruthy()
})
it('loads the "UserProfileTransactionList" component', async () => {
it('loads the "Transactions" page', async () => {
const component = await routes.find((r) => r.path === '/transactions').component()
expect(component.default.name).toBe('UserProfileTransactionList')
expect(component.default.name).toBe('Transactions')
})
})
describe('login', () => {
it('loads the "Login" component', async () => {
it('loads the "Login" page', async () => {
const component = await routes.find((r) => r.path === '/login').component()
expect(component.default.name).toBe('login')
expect(component.default.name).toBe('Login')
})
})
describe('register', () => {
it('loads the "register" component', async () => {
it('loads the "register" page', async () => {
const component = await routes.find((r) => r.path === '/register').component()
expect(component.default.name).toBe('register')
expect(component.default.name).toBe('Register')
})
})
describe('thx', () => {
const thx = routes.find((r) => r.path === '/thx/:comingFrom')
it('loads the "Thx" component', async () => {
it('loads the "Thx" page', async () => {
const component = await thx.component()
expect(component.default.name).toBe('Thx')
})
@ -130,56 +130,60 @@ 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" page', 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" page', async () => {
const component = await routes
.find((r) => r.path === '/forgot-password/:comingFrom')
.component()
expect(component.default.name).toBe('ForgotPassword')
})
})
describe('register-community', () => {
it('loads the "registerCommunity" component', async () => {
it('loads the "registerCommunity" page', async () => {
const component = await routes.find((r) => r.path === '/register-community').component()
expect(component.default.name).toBe('registerCommunity')
expect(component.default.name).toBe('RegisterCommunity')
})
})
describe('select-community', () => {
it('loads the "registerSelectCommunity" component', async () => {
it('loads the "SelectCommunity" page', async () => {
const component = await routes.find((r) => r.path === '/select-community').component()
expect(component.default.name).toBe('registerSelectCommunity')
expect(component.default.name).toBe('SelectCommunity')
})
})
describe('reset', () => {
it('loads the "ResetPassword" component', async () => {
const component = await routes.find((r) => r.path === '/reset/:optin').component()
describe('reset password', () => {
it('loads the "ResetPassword" page', async () => {
const component = await routes
.find((r) => r.path === '/reset-password/:optin')
.component()
expect(component.default.name).toBe('ResetPassword')
})
})
describe('checkEmail', () => {
it('loads the "CheckEmail" component', async () => {
it('loads the "CheckEmail" page', async () => {
const component = await routes.find((r) => r.path === '/checkEmail/:optin').component()
expect(component.default.name).toBe('ResetPassword')
})
})
describe('not found page', () => {
it('renders the "NotFound" component', async () => {
it('renders the "NotFound" page', async () => {
expect(routes.find((r) => r.path === '*').component).toEqual(NotFound)
})
})

View File

@ -1,4 +1,4 @@
import NotFound from '@/views/NotFoundPage.vue'
import NotFound from '@/pages/NotFoundPage.vue'
const routes = [
{
@ -12,45 +12,45 @@ const routes = [
},
{
path: '/overview',
component: () => import('../views/Pages/AccountOverview.vue'),
component: () => import('@/pages/Overview.vue'),
meta: {
requiresAuth: true,
},
},
{
path: '/send',
component: () => import('../views/Pages/SendOverview.vue'),
component: () => import('@/pages/Send.vue'),
meta: {
requiresAuth: true,
},
},
{
path: '/profile',
component: () => import('../views/Pages/UserProfileOverview.vue'),
component: () => import('@/pages/Profile.vue'),
meta: {
requiresAuth: true,
},
},
{
path: '/transactions',
component: () => import('../views/Pages/UserProfileTransactionList.vue'),
component: () => import('@/pages/Transactions.vue'),
meta: {
requiresAuth: true,
},
},
{
path: '/login',
component: () => import('../views/Pages/Login.vue'),
component: () => import('@/pages/Login.vue'),
},
{
path: '/register',
component: () => import('../views/Pages/Register.vue'),
component: () => import('@/pages/Register.vue'),
},
{
path: '/thx/:comingFrom',
component: () => import('../views/Pages/thx.vue'),
component: () => import('@/pages/thx.vue'),
beforeEnter: (to, from, next) => {
const validFrom = ['password', 'reset', 'register', 'login', 'checkEmail']
const validFrom = ['forgot-password', 'reset-password', 'register', 'login', 'checkEmail']
if (!validFrom.includes(from.path.split('/')[1])) {
next({ path: '/login' })
} else {
@ -59,28 +59,28 @@ const routes = [
},
},
{
path: '/password',
component: () => import('../views/Pages/ForgotPassword.vue'),
path: '/forgot-password',
component: () => import('@/pages/ForgotPassword.vue'),
},
{
path: '/password/:comingFrom',
component: () => import('../views/Pages/ForgotPassword.vue'),
path: '/forgot-password/:comingFrom',
component: () => import('@/pages/ForgotPassword.vue'),
},
{
path: '/register-community',
component: () => import('../views/Pages/RegisterCommunity.vue'),
component: () => import('@/pages/RegisterCommunity.vue'),
},
{
path: '/select-community',
component: () => import('../views/Pages/RegisterSelectCommunity.vue'),
component: () => import('@/pages/SelectCommunity.vue'),
},
{
path: '/reset/:optin',
component: () => import('../views/Pages/ResetPassword.vue'),
path: '/reset-password/:optin',
component: () => import('@/pages/ResetPassword.vue'),
},
{
path: '/checkEmail/:optin',
component: () => import('../views/Pages/ResetPassword.vue'),
component: () => import('@/pages/ResetPassword.vue'),
},
{ path: '*', component: NotFound },
]

View File

@ -2,7 +2,7 @@ import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import { localeChanged } from 'vee-validate'
import i18n from '../i18n.js'
import i18n from '@/i18n.js'
Vue.use(Vuex)

View File

@ -1,11 +1,11 @@
import { mutations, actions } from './store'
import Vuex from 'vuex'
import Vue from 'vue'
import i18n from '../i18n.js'
import i18n from '@/i18n.js'
import { localeChanged } from 'vee-validate'
jest.mock('vuex')
jest.mock('../i18n.js')
jest.mock('@/i18n.js')
jest.mock('vee-validate', () => {
return {
localeChanged: jest.fn(),

View File

@ -1,38 +0,0 @@
import { shallowMount } from '@vue/test-utils'
import UserProfileOverview from './UserProfileOverview'
const localVue = global.localVue
describe('UserProfileOverview', () => {
let wrapper
const mocks = {
$t: jest.fn((t) => t),
}
const Wrapper = () => {
return shallowMount(UserProfileOverview, { localVue, mocks })
}
describe('shallow Mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('has a user card', () => {
expect(wrapper.findComponent({ name: 'UserCard' }).exists()).toBeTruthy()
})
it('has a user first and last name form', () => {
expect(wrapper.findComponent({ name: 'FormUserData' }).exists()).toBeTruthy()
})
it('has a user change password form', () => {
expect(wrapper.findComponent({ name: 'FormUserPasswort' }).exists()).toBeTruthy()
})
it('has a user change language form', () => {
expect(wrapper.findComponent({ name: 'FormUserLanguage' }).exists()).toBeTruthy()
})
})
})