diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index 633d0e1ae..44fa170b1 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -11,7 +11,7 @@ describe('ContributionForm', () => { $d: jest.fn((d) => d), $store: { state: { - creation: ["1000","1000","1000"], + creation: ['1000', '1000', '1000'], }, }, } diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index 499c23e63..cbc986326 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -57,23 +57,23 @@ export default { }, computed: { type() { - if (this.deletedAt !== null) return 'deleted' - if (this.confirmedAt !== null) return 'confirmed' + if (this.deletedAt) return 'deleted' + if (this.confirmedAt) return 'confirmed' return 'pending' }, icon() { - if (this.deletedAt !== null) return 'x-circle' - if (this.confirmedAt !== null) return 'check' + if (this.deletedAt) return 'x-circle' + if (this.confirmedAt) return 'check' return 'bell-fill' }, variant() { - if (this.deletedAt !== null) return 'danger' - if (this.confirmedAt !== null) return 'success' + if (this.deletedAt) return 'danger' + if (this.confirmedAt) return 'success' return 'primary' }, date() { - if (this.deletedAt !== null) return this.deletedAt - if (this.confirmedAt !== null) return this.confirmedAt + if (this.deletedAt) return this.deletedAt + if (this.confirmedAt) return this.confirmedAt return this.createdAt }, }, diff --git a/frontend/src/pages/Community.spec.js b/frontend/src/pages/Community.spec.js index a90f035ee..efb96cc67 100644 --- a/frontend/src/pages/Community.spec.js +++ b/frontend/src/pages/Community.spec.js @@ -4,8 +4,23 @@ import Community from './Community' const localVue = global.localVue const mockStoreDispach = jest.fn() +const apolloQueryMock = jest.fn() const apolloMutationMock = jest.fn() -apolloMutationMock.mockResolvedValue('success') +apolloQueryMock.mockResolvedValue({ + data: { + listContributions: [ + { + id: 1555, + amount: '200', + memo: 'Fleisig, fleisig am Arbeiten mein Lieber Freund, 50 Zeichen sind viel', + createdAt: '2022-07-15T08:47:06.000Z', + deletedAt: null, + confirmedBy: null, + confirmedAt: null, + }, + ], + }, +}) describe('Community', () => { let wrapper @@ -14,10 +29,14 @@ describe('Community', () => { $t: jest.fn((t) => t), $d: jest.fn((d) => d), $apollo: { + query: apolloQueryMock, mutate: apolloMutationMock, }, $store: { dispatch: mockStoreDispach, + state: { + creation: ['1000', '1000', '1000'], + }, }, } diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue index ddf4333bf..42102a005 100644 --- a/frontend/src/pages/Community.vue +++ b/frontend/src/pages/Community.vue @@ -73,7 +73,7 @@ export default { this.toastError(err.message) }) }, - async updateListContributions(pagination) { + updateListContributions(pagination) { this.$apollo .query({ fetchPolicy: 'no-cache',