From 07c50c97d8363ce6931df8c417af9100e276b567 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 6 Feb 2023 15:37:13 +0100 Subject: [PATCH] test coverage by 95.32% --- .../ContributionLink/ContributionLink.spec.js | 30 +++++++++++++++---- .../graphql/listUnconfirmedContributions.js | 10 ------- admin/src/pages/CreationConfirm.vue | 9 +++++- 3 files changed, 32 insertions(+), 17 deletions(-) delete mode 100644 admin/src/graphql/listUnconfirmedContributions.js diff --git a/admin/src/components/ContributionLink/ContributionLink.spec.js b/admin/src/components/ContributionLink/ContributionLink.spec.js index b72a0347c..5a9e6befe 100644 --- a/admin/src/components/ContributionLink/ContributionLink.spec.js +++ b/admin/src/components/ContributionLink/ContributionLink.spec.js @@ -42,14 +42,32 @@ describe('ContributionLink', () => { expect(wrapper.find('div.contribution-link').exists()).toBe(true) }) - it('emits toggle::collapse new Contribution', async () => { - wrapper.vm.editContributionLinkData() - expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() + describe('collapse open new Contribution', () => { + beforeEach(() => { + wrapper.vm.editContributionLinkData() + }) + it('emits toggle::collapse new Contribution', () => { + expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() + }) + it('has collapse visible true', () => { + expect(wrapper.vm.visible).toBe(true) + }) }) - it('emits toggle::collapse close Contribution-Form ', async () => { - wrapper.vm.closeContributionForm() - expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() + describe('collapse close Contribution Form', () => { + beforeEach(() => { + wrapper.setData({ visible: true }) + wrapper.vm.closeContributionForm() + }) + + it('has collapse visible false', async () => { + await wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution') + expect(wrapper.vm.visible).toBe(false) + }) + + it('has editContributionLink false', () => { + expect(wrapper.vm.editContributionLink).toBe(false) + }) }) }) }) diff --git a/admin/src/graphql/listUnconfirmedContributions.js b/admin/src/graphql/listUnconfirmedContributions.js deleted file mode 100644 index 235909913..000000000 --- a/admin/src/graphql/listUnconfirmedContributions.js +++ /dev/null @@ -1,10 +0,0 @@ -import gql from 'graphql-tag' - -export const listUnconfirmedContributions = gql` - query { - listUnconfirmedContributions { - id - state - } - } -` diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index 3a3e902c0..b13869dd3 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -208,7 +208,6 @@ export default { { key: 'confirm', label: this.$t('save') }, ], [ - { key: 'state', label: 'state' }, { key: 'firstName', label: this.$t('firstname') }, { key: 'lastName', label: this.$t('lastname') }, { @@ -233,6 +232,13 @@ export default { return this.$d(new Date(value), 'short') }, }, + { + key: 'confirmedAt', + label: this.$t('contributions.confirms'), + formatter: (value) => { + return this.$d(new Date(value), 'short') + }, + }, { key: 'chatCreation', label: this.$t('chat') }, ], [ @@ -273,6 +279,7 @@ export default { ], [], [ + { key: 'state', label: 'state' }, { key: 'firstName', label: this.$t('firstname') }, { key: 'lastName', label: this.$t('lastname') }, {