diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1e363b52..b3c097993 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -422,7 +422,7 @@ jobs: report_name: Coverage Admin Interface type: lcov result_path: ./coverage/lcov.info - min_coverage: 94 + min_coverage: 95 token: ${{ github.token }} ############################################################################## diff --git a/CHANGELOG.md b/CHANGELOG.md index a073aeb5f..6c64df990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,36 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.6.6](https://github.com/gradido/gradido/compare/1.6.5...1.6.6) + +- Fix: Upper case email on register breaks account [`#1542`](https://github.com/gradido/gradido/pull/1542) +- 1106 first transaction cannot be expanded [`#1432`](https://github.com/gradido/gradido/pull/1432) +- added missing bootstrap scss. bootstrap/scss/bootstrap, plus more mis… [`#1540`](https://github.com/gradido/gradido/pull/1540) +- feat: Seed Deleted User [`#1533`](https://github.com/gradido/gradido/pull/1533) +- fix: No Creations for Deleted Users [`#1534`](https://github.com/gradido/gradido/pull/1534) +- fix: Wrong Key Name for Recover User [`#1535`](https://github.com/gradido/gradido/pull/1535) +- [Feature] : user deleted and undeleted functions for adminarea [`#1520`](https://github.com/gradido/gradido/pull/1520) +- fix: Possible SQL Exception in User Search [`#1530`](https://github.com/gradido/gradido/pull/1530) +- Feature: Make lint warnings unwanted [`#1529`](https://github.com/gradido/gradido/pull/1529) +- 1459 list data again on confirm creation [`#1467`](https://github.com/gradido/gradido/pull/1467) +- fix: Return Empty Array When No Pending Creations Are Present [`#1526`](https://github.com/gradido/gradido/pull/1526) +- Fix: Correct path of index.js in production [`#1525`](https://github.com/gradido/gradido/pull/1525) +- refactor: Get Open Creations by One Query [`#1524`](https://github.com/gradido/gradido/pull/1524) +- Admin: Langsame Benutzer-Suche [`#1472`](https://github.com/gradido/gradido/pull/1472) +- fix: Backend Unit Tests Running Again [`#1513`](https://github.com/gradido/gradido/pull/1513) +- Refactor: Combine transaction tables [`#1523`](https://github.com/gradido/gradido/pull/1523) +- Refactor: User resolver [`#1522`](https://github.com/gradido/gradido/pull/1522) +- feature: Soft-Delete for users (backend) [`#1521`](https://github.com/gradido/gradido/pull/1521) +- feature: Soft-Delete for users (database only) [`#1516`](https://github.com/gradido/gradido/pull/1516) +- refactor: Improve Decay Display [`#1517`](https://github.com/gradido/gradido/pull/1517) +- 404 page needs back to login button [`#1515`](https://github.com/gradido/gradido/pull/1515) +- feature: show current version in admin footer [`#1514`](https://github.com/gradido/gradido/pull/1514) +- fix: Never Sent Email Text [`#1512`](https://github.com/gradido/gradido/pull/1512) +- refactor: static decay block [`#1405`](https://github.com/gradido/gradido/pull/1405) +- refactor: Use Bootstrap Vue Toast [`#1499`](https://github.com/gradido/gradido/pull/1499) +- fix: Catch GDT Server Errors [`#1479`](https://github.com/gradido/gradido/pull/1479) +- Fix: Autochangelog - no commits [`#1498`](https://github.com/gradido/gradido/pull/1498) + #### [1.6.5](https://github.com/gradido/gradido/compare/1.6.4...1.6.5) > 15 February 2022 diff --git a/admin/package.json b/admin/package.json index 677095a28..d499117af 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "1.6.5", + "version": "1.6.6", "license": "MIT", "private": false, "scripts": { @@ -11,7 +11,7 @@ "serve": "vue-cli-service serve --open", "dev": "yarn run serve", "build": "vue-cli-service build", - "lint": "eslint --ext .js,.vue .", + "lint": "eslint --max-warnings=0 --ext .js,.vue .", "test": "TZ=UTC jest --coverage", "locales": "scripts/missing-keys.sh && scripts/sort.sh" }, @@ -36,6 +36,7 @@ "graphql": "^15.6.1", "identity-obj-proxy": "^3.0.0", "jest": "26.6.3", + "portal-vue": "^2.1.7", "regenerator-runtime": "^0.13.9", "stats-webpack-plugin": "^0.7.0", "vue": "^2.6.11", @@ -43,7 +44,6 @@ "vue-i18n": "^8.26.5", "vue-jest": "^3.0.7", "vue-router": "^3.5.3", - "vue-toasted": "^1.1.28", "vuex": "^3.6.2", "vuex-persistedstate": "^4.1.0" }, diff --git a/admin/public/img/elopage_favicon.png b/admin/public/img/elopage_favicon.png new file mode 100644 index 000000000..2da7efbc0 Binary files /dev/null and b/admin/public/img/elopage_favicon.png differ diff --git a/admin/src/components/ConfirmRegisterMailFormular.spec.js b/admin/src/components/ConfirmRegisterMailFormular.spec.js index 78f5791dc..e9e21b31e 100644 --- a/admin/src/components/ConfirmRegisterMailFormular.spec.js +++ b/admin/src/components/ConfirmRegisterMailFormular.spec.js @@ -1,21 +1,17 @@ import { mount } from '@vue/test-utils' import ConfirmRegisterMailFormular from './ConfirmRegisterMailFormular.vue' +import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' + const localVue = global.localVue const apolloMutateMock = jest.fn().mockResolvedValue() -const toastSuccessMock = jest.fn() -const toastErrorMock = jest.fn() const mocks = { $t: jest.fn((t) => t), $apollo: { mutate: apolloMutateMock, }, - $toasted: { - success: toastSuccessMock, - error: toastErrorMock, - }, } const propsData = { @@ -54,7 +50,7 @@ describe('ConfirmRegisterMailFormular', () => { }) it('toasts a success message', () => { - expect(toastSuccessMock).toBeCalledWith('unregister_mail.success') + expect(toastSuccessSpy).toBeCalledWith('unregister_mail.success') }) }) @@ -66,7 +62,7 @@ describe('ConfirmRegisterMailFormular', () => { }) it('toasts an error message', () => { - expect(toastErrorMock).toBeCalledWith('unregister_mail.error') + expect(toastErrorSpy).toBeCalledWith('unregister_mail.error') }) }) }) diff --git a/admin/src/components/ConfirmRegisterMailFormular.vue b/admin/src/components/ConfirmRegisterMailFormular.vue index 067e95c67..1b72f55d0 100644 --- a/admin/src/components/ConfirmRegisterMailFormular.vue +++ b/admin/src/components/ConfirmRegisterMailFormular.vue @@ -48,10 +48,10 @@ export default { }, }) .then(() => { - this.$toasted.success(this.$t('unregister_mail.success', { email: this.email })) + this.toastSuccess(this.$t('unregister_mail.success', { email: this.email })) }) .catch((error) => { - this.$toasted.error(this.$t('unregister_mail.error', { message: error.message })) + this.toastError(this.$t('unregister_mail.error', { message: error.message })) }) }, }, diff --git a/admin/src/components/CreationFormular.spec.js b/admin/src/components/CreationFormular.spec.js index cfc23fa26..083b7ca67 100644 --- a/admin/src/components/CreationFormular.spec.js +++ b/admin/src/components/CreationFormular.spec.js @@ -2,6 +2,7 @@ import { mount } from '@vue/test-utils' import CreationFormular from './CreationFormular.vue' import { createPendingCreation } from '../graphql/createPendingCreation' import { createPendingCreations } from '../graphql/createPendingCreations' +import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' const localVue = global.localVue @@ -11,8 +12,6 @@ const apolloMutateMock = jest.fn().mockResolvedValue({ }, }) const stateCommitMock = jest.fn() -const toastedErrorMock = jest.fn() -const toastedSuccessMock = jest.fn() const mocks = { $t: jest.fn((t, options) => (options ? [t, options] : t)), @@ -32,10 +31,6 @@ const mocks = { }, }, }, - $toasted: { - error: toastedErrorMock, - success: toastedSuccessMock, - }, } const propsData = { @@ -140,7 +135,7 @@ describe('CreationFormular', () => { }) it('toasts a success message', () => { - expect(toastedSuccessMock).toBeCalledWith([ + expect(toastSuccessSpy).toBeCalledWith([ 'creation_form.toasted', { email: 'benjamin@bluemchen.de', value: '90' }, ]) @@ -162,7 +157,7 @@ describe('CreationFormular', () => { }) it('toasts an error message', () => { - expect(toastedErrorMock).toBeCalledWith('Ouch!') + expect(toastErrorSpy).toBeCalledWith('Ouch!') }) }) @@ -292,7 +287,7 @@ describe('CreationFormular', () => { }) it('toast success message', () => { - expect(toastedSuccessMock).toBeCalled() + expect(toastSuccessSpy).toBeCalled() }) it('store commit openCreationPlus', () => { @@ -426,13 +421,14 @@ describe('CreationFormular', () => { expect(stateCommitMock).toBeCalledWith('openCreationsPlus', 0) }) - it('toasts two errors', () => { - expect(toastedErrorMock).toBeCalledWith( - 'Could not created PendingCreation for bob@baumeister.de', - ) - expect(toastedErrorMock).toBeCalledWith( - 'Could not created PendingCreation for bibi@bloxberg.de', - ) + it('emits remove all bookmarks', () => { + expect(wrapper.emitted('remove-all-bookmark')).toBeTruthy() + }) + + it('emits toast failed creations with two emails', () => { + expect(wrapper.emitted('toast-failed-creations')).toEqual([ + [['bob@baumeister.de', 'bibi@bloxberg.de']], + ]) }) }) @@ -454,7 +450,7 @@ describe('CreationFormular', () => { }) it('toasts an error message', () => { - expect(toastedErrorMock).toBeCalledWith('Oh no!') + expect(toastErrorSpy).toBeCalledWith('Oh no!') }) }) }) diff --git a/admin/src/components/CreationFormular.vue b/admin/src/components/CreationFormular.vue index 34df13e11..cd4de5fd6 100644 --- a/admin/src/components/CreationFormular.vue +++ b/admin/src/components/CreationFormular.vue @@ -166,20 +166,21 @@ export default { fetchPolicy: 'no-cache', }) .then((result) => { + const failedCreations = [] this.$store.commit( 'openCreationsPlus', result.data.createPendingCreations.successfulCreation.length, ) if (result.data.createPendingCreations.failedCreation.length > 0) { - result.data.createPendingCreations.failedCreation.forEach((failed) => { - // TODO: Please localize this error message - this.$toasted.error('Could not created PendingCreation for ' + failed) + result.data.createPendingCreations.failedCreation.forEach((email) => { + failedCreations.push(email) }) } this.$emit('remove-all-bookmark') + this.$emit('toast-failed-creations', failedCreations) }) .catch((error) => { - this.$toasted.error(error.message) + this.toastError(error.message) }) } else if (this.type === 'singleCreation') { submitObj = { @@ -196,19 +197,19 @@ export default { }) .then((result) => { this.$emit('update-user-data', this.item, result.data.createPendingCreation) - this.$toasted.success( + this.$store.commit('openCreationsPlus', 1) + this.toastSuccess( this.$t('creation_form.toasted', { value: this.value, email: this.item.email, }), ) - this.$store.commit('openCreationsPlus', 1) // what is this? Tests says that this.text is not reseted this.$refs.creationForm.reset() this.value = 0 }) .catch((error) => { - this.$toasted.error(error.message) + this.toastError(error.message) this.$refs.creationForm.reset() this.value = 0 }) diff --git a/admin/src/components/CreationTransactionListFormular.spec.js b/admin/src/components/CreationTransactionListFormular.spec.js index 88cda89ee..5acff8ab7 100644 --- a/admin/src/components/CreationTransactionListFormular.spec.js +++ b/admin/src/components/CreationTransactionListFormular.spec.js @@ -1,5 +1,6 @@ import { mount } from '@vue/test-utils' import CreationTransactionListFormular from './CreationTransactionListFormular.vue' +import { toastErrorSpy } from '../../test/testSetup' const localVue = global.localVue @@ -8,41 +9,25 @@ const apolloQueryMock = jest.fn().mockResolvedValue({ transactionList: { transactions: [ { - type: 'creation', - balance: 100, - decayStart: 0, - decayEnd: 0, - decayDuration: 0, + id: 1, + amount: 100, + balanceDate: 0, + creationDate: new Date(), memo: 'Testing', - transactionId: 1, - name: 'Gradido Akademie', - email: 'bibi@bloxberg.de', - date: new Date(), - decay: { - balance: 0.01, - decayStart: 0, - decayEnd: 0, - decayDuration: 0, - decayStartBlock: 0, + linkedUser: { + firstName: 'Gradido', + lastName: 'Akademie', }, }, { - type: 'creation', - balance: 200, - decayStart: 0, - decayEnd: 0, - decayDuration: 0, + id: 2, + amount: 200, + balanceDate: 0, + creationDate: new Date(), memo: 'Testing 2', - transactionId: 2, - name: 'Gradido Akademie', - email: 'bibi@bloxberg.de', - date: new Date(), - decay: { - balance: 0.01, - decayStart: 0, - decayEnd: 0, - decayDuration: 0, - decayStartBlock: 0, + linkedUser: { + firstName: 'Gradido', + lastName: 'Akademie', }, }, ], @@ -50,17 +35,12 @@ const apolloQueryMock = jest.fn().mockResolvedValue({ }, }) -const toastedErrorMock = jest.fn() - const mocks = { $d: jest.fn((t) => t), $t: jest.fn((t) => t), $apollo: { query: apolloQueryMock, }, - $toasted: { - error: toastedErrorMock, - }, } const propsData = { @@ -109,7 +89,7 @@ describe('CreationTransactionListFormular', () => { }) it('toast error', () => { - expect(toastedErrorMock).toBeCalledWith('OUCH!') + expect(toastErrorSpy).toBeCalledWith('OUCH!') }) }) }) diff --git a/admin/src/components/CreationTransactionListFormular.vue b/admin/src/components/CreationTransactionListFormular.vue index 627647534..0b78ca4b8 100644 --- a/admin/src/components/CreationTransactionListFormular.vue +++ b/admin/src/components/CreationTransactionListFormular.vue @@ -15,30 +15,32 @@ export default { return { fields: [ { - key: 'date', + key: 'creationDate', label: this.$t('transactionlist.date'), formatter: (value, key, item) => { return this.$d(new Date(value)) }, }, { - key: 'balance', + key: 'amount', label: this.$t('transactionlist.amount'), formatter: (value, key, item) => { return `${value} GDD` }, }, - { key: 'name', label: this.$t('transactionlist.community') }, + { + key: 'linkedUser', + label: this.$t('transactionlist.community'), + formatter: (value, key, item) => { + return `${value.firstName} ${value.lastName}` + }, + }, { key: 'memo', label: this.$t('transactionlist.memo') }, { - key: 'decay', - label: this.$t('transactionlist.decay'), + key: 'balanceDate', + label: this.$t('transactionlist.balanceDate'), formatter: (value, key, item) => { - if (value && value.balance >= 0) { - return value.balance - } else { - return '0' - } + return this.$d(new Date(value)) }, }, ], @@ -59,10 +61,10 @@ export default { }, }) .then((result) => { - this.items = result.data.transactionList.transactions.filter((t) => t.type === 'creation') + this.items = result.data.transactionList.transactions }) .catch((error) => { - this.$toasted.error(error.message) + this.toastError(error.message) }) }, }, diff --git a/admin/src/components/DeletedUserFormular.spec.js b/admin/src/components/DeletedUserFormular.spec.js new file mode 100644 index 000000000..5c41831e5 --- /dev/null +++ b/admin/src/components/DeletedUserFormular.spec.js @@ -0,0 +1,248 @@ +import { mount } from '@vue/test-utils' +import DeletedUserFormular from './DeletedUserFormular.vue' +import { deleteUser } from '../graphql/deleteUser' +import { unDeleteUser } from '../graphql/unDeleteUser' +import { toastErrorSpy } from '../../test/testSetup' + +const localVue = global.localVue + +const date = new Date() + +const apolloMutateMock = jest.fn().mockResolvedValue({ + data: { + deleteUser: date, + }, +}) + +const mocks = { + $t: jest.fn((t) => t), + $apollo: { + mutate: apolloMutateMock, + }, + $store: { + state: { + moderator: { + id: 0, + name: 'test moderator', + }, + }, + }, +} + +const propsData = { + item: {}, +} + +describe('DeletedUserFormular', () => { + let wrapper + + const Wrapper = () => { + return mount(DeletedUserFormular, { localVue, mocks, propsData }) + } + + describe('mount', () => { + beforeEach(() => { + jest.clearAllMocks() + wrapper = Wrapper() + }) + + it('has a DIV element with the class.delete-user-formular', () => { + expect(wrapper.find('.deleted-user-formular').exists()).toBeTruthy() + }) + }) + + describe('delete self', () => { + beforeEach(() => { + wrapper.setProps({ + item: { + userId: 0, + }, + }) + }) + + it('shows a text that you cannot delete yourself', () => { + expect(wrapper.text()).toBe('removeNotSelf') + }) + }) + + describe('delete other user', () => { + beforeEach(() => { + wrapper.setProps({ + item: { + userId: 1, + deletedAt: null, + }, + }) + }) + + it('has a checkbox', () => { + expect(wrapper.find('input[type="checkbox"]').exists()).toBeTruthy() + }) + + it('shows the text "delete_user"', () => { + expect(wrapper.text()).toBe('delete_user') + }) + + describe('click on checkbox', () => { + beforeEach(async () => { + await wrapper.find('input[type="checkbox"]').setChecked() + }) + + it('has a confirmation button', () => { + expect(wrapper.find('button').exists()).toBeTruthy() + }) + + it('has the button text "delete_user"', () => { + expect(wrapper.find('button').text()).toBe('delete_user') + }) + + describe('confirm delete with success', () => { + beforeEach(async () => { + await wrapper.find('button').trigger('click') + }) + + it('calls the API', () => { + expect(apolloMutateMock).toBeCalledWith( + expect.objectContaining({ + mutation: deleteUser, + variables: { + userId: 1, + }, + }), + ) + }) + + it('emits update deleted At', () => { + expect(wrapper.emitted('updateDeletedAt')).toEqual( + expect.arrayContaining([ + expect.arrayContaining([ + { + userId: 1, + deletedAt: date, + }, + ]), + ]), + ) + }) + + it('unchecks the checkbox', () => { + expect(wrapper.find('input').attributes('checked')).toBe(undefined) + }) + }) + + describe('confirm delete with error', () => { + beforeEach(async () => { + apolloMutateMock.mockRejectedValue({ message: 'Oh no!' }) + await wrapper.find('button').trigger('click') + }) + + it('toasts an error message', () => { + expect(toastErrorSpy).toBeCalledWith('Oh no!') + }) + }) + + describe('click on checkbox again', () => { + beforeEach(async () => { + await wrapper.find('input[type="checkbox"]').setChecked(false) + }) + + it('has no confirmation button anymore', () => { + expect(wrapper.find('button').exists()).toBeFalsy() + }) + }) + }) + }) + + describe('recover user', () => { + beforeEach(() => { + wrapper.setProps({ + item: { + userId: 1, + deletedAt: date, + }, + }) + }) + + it('has a checkbox', () => { + expect(wrapper.find('input[type="checkbox"]').exists()).toBeTruthy() + }) + + it('shows the text "undelete_user"', () => { + expect(wrapper.text()).toBe('undelete_user') + }) + + describe('click on checkbox', () => { + beforeEach(async () => { + apolloMutateMock.mockResolvedValue({ + data: { + unDeleteUser: null, + }, + }) + await wrapper.find('input[type="checkbox"]').setChecked() + }) + + it('has a confirmation button', () => { + expect(wrapper.find('button').exists()).toBeTruthy() + }) + + it('has the button text "undelete_user"', () => { + expect(wrapper.find('button').text()).toBe('undelete_user') + }) + + describe('confirm recover with success', () => { + beforeEach(async () => { + await wrapper.find('button').trigger('click') + }) + + it('calls the API', () => { + expect(apolloMutateMock).toBeCalledWith( + expect.objectContaining({ + mutation: unDeleteUser, + variables: { + userId: 1, + }, + }), + ) + }) + + it('emits update deleted At', () => { + expect(wrapper.emitted('updateDeletedAt')).toEqual( + expect.arrayContaining([ + expect.arrayContaining([ + { + userId: 1, + deletedAt: null, + }, + ]), + ]), + ) + }) + + it('unchecks the checkbox', () => { + expect(wrapper.find('input').attributes('checked')).toBe(undefined) + }) + }) + + describe('confirm recover with error', () => { + beforeEach(async () => { + apolloMutateMock.mockRejectedValue({ message: 'Oh no!' }) + await wrapper.find('button').trigger('click') + }) + + it('toasts an error message', () => { + expect(toastErrorSpy).toBeCalledWith('Oh no!') + }) + }) + + describe('click on checkbox again', () => { + beforeEach(async () => { + await wrapper.find('input[type="checkbox"]').setChecked(false) + }) + + it('has no confirmation button anymore', () => { + expect(wrapper.find('button').exists()).toBeFalsy() + }) + }) + }) + }) +}) diff --git a/admin/src/components/DeletedUserFormular.vue b/admin/src/components/DeletedUserFormular.vue new file mode 100644 index 000000000..03359d9f9 --- /dev/null +++ b/admin/src/components/DeletedUserFormular.vue @@ -0,0 +1,85 @@ + + + diff --git a/admin/src/components/EditCreationFormular.spec.js b/admin/src/components/EditCreationFormular.spec.js index 84d3e26d3..f5c7fb0fe 100644 --- a/admin/src/components/EditCreationFormular.spec.js +++ b/admin/src/components/EditCreationFormular.spec.js @@ -1,5 +1,6 @@ import { mount } from '@vue/test-utils' import EditCreationFormular from './EditCreationFormular.vue' +import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' const localVue = global.localVue @@ -16,8 +17,6 @@ const apolloMutateMock = jest.fn().mockResolvedValue({ }) const stateCommitMock = jest.fn() -const toastedErrorMock = jest.fn() -const toastedSuccessMock = jest.fn() const mocks = { $t: jest.fn((t) => t), @@ -37,10 +36,6 @@ const mocks = { }, commit: stateCommitMock, }, - $toasted: { - error: toastedErrorMock, - success: toastedSuccessMock, - }, } const now = new Date(Date.now()) @@ -142,7 +137,7 @@ describe('EditCreationFormular', () => { }) it('toasts a success message', () => { - expect(toastedSuccessMock).toBeCalledWith('creation_form.toasted_update') + expect(toastSuccessSpy).toBeCalledWith('creation_form.toasted_update') }) }) @@ -155,7 +150,7 @@ describe('EditCreationFormular', () => { }) it('toasts an error message', () => { - expect(toastedErrorMock).toBeCalledWith('Oh no!') + expect(toastErrorSpy).toBeCalledWith('Oh no!') }) }) }) diff --git a/admin/src/components/EditCreationFormular.vue b/admin/src/components/EditCreationFormular.vue index 650b00410..82b444154 100644 --- a/admin/src/components/EditCreationFormular.vue +++ b/admin/src/components/EditCreationFormular.vue @@ -132,7 +132,7 @@ export default { moderator: Number(result.data.updatePendingCreation.moderator), row: this.row, }) - this.$toasted.success( + this.toastSuccess( this.$t('creation_form.toasted_update', { value: this.value, email: this.item.email, @@ -144,7 +144,7 @@ export default { this.value = 0 }) .catch((error) => { - this.$toasted.error(error.message) + this.toastError(error.message) // das creation Formular reseten this.$refs.updateCreationForm.reset() // Den geschöpften Wert auf o setzen diff --git a/admin/src/components/RowDetails.vue b/admin/src/components/RowDetails.vue index 319936a70..84dfebbb5 100644 --- a/admin/src/components/RowDetails.vue +++ b/admin/src/components/RowDetails.vue @@ -1,10 +1,7 @@ @@ -27,7 +27,7 @@ type="show-creation" slotName="show-creation" :index="0" - @row-toogle-details="rowToogleDetails" + @row-toggle-details="rowToggleDetails" > diff --git a/frontend/src/views/Pages/ResetPassword.spec.js b/frontend/src/pages/ResetPassword.spec.js similarity index 92% rename from frontend/src/views/Pages/ResetPassword.spec.js rename to frontend/src/pages/ResetPassword.spec.js index 5ee2742f2..814d97bcb 100644 --- a/frontend/src/views/Pages/ResetPassword.spec.js +++ b/frontend/src/pages/ResetPassword.spec.js @@ -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') }) }) }) diff --git a/frontend/src/views/Pages/ResetPassword.vue b/frontend/src/pages/ResetPassword.vue similarity index 91% rename from frontend/src/views/Pages/ResetPassword.vue rename to frontend/src/pages/ResetPassword.vue index e4adeda9f..830107a99 100644 --- a/frontend/src/views/Pages/ResetPassword.vue +++ b/frontend/src/pages/ResetPassword.vue @@ -44,8 +44,8 @@ - diff --git a/frontend/src/views/Pages/UserProfileOverview.spec.js b/frontend/src/views/Pages/UserProfileOverview.spec.js deleted file mode 100644 index 7b75b0dd2..000000000 --- a/frontend/src/views/Pages/UserProfileOverview.spec.js +++ /dev/null @@ -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() - }) - }) -}) diff --git a/frontend/test/testSetup.js b/frontend/test/testSetup.js index 2e26db998..0ceb5affd 100644 --- a/frontend/test/testSetup.js +++ b/frontend/test/testSetup.js @@ -17,7 +17,9 @@ import { focus } from 'vue-focus' import { loadAllRules } from '../src/validation-rules' -import { toasters } from '../src/mixins/toaster' +import { loadFilters } from '@/filters/amount' + +import { toasters } from '@/mixins/toaster' export const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError') export const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess') @@ -53,6 +55,10 @@ global.localVue.directive('focus', focus) global.localVue.mixin(toasters) +const filters = loadFilters(i18nMock) +global.localVue.filter('amount', filters.amount) +global.localVue.filter('GDD', filters.GDD) + // Filter the warnings for portal vue // https://github.com/BeniRupp/bug_portal-vue-target-already-exists const consoleWarn = global.console.warn diff --git a/package.json b/package.json index 7bac69382..d18af7954 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gradido", - "version": "1.6.5", + "version": "1.6.6", "description": "Gradido", "main": "index.js", "repository": "git@github.com:gradido/gradido.git",