From d3ff893b296ba67ec995349d602c02d15e80d207 Mon Sep 17 00:00:00 2001 From: Dat Date: Wed, 11 Nov 2026 16:28:57 +0100 Subject: [PATCH 1/7] test: cover dashboard status dialog content --- .../WikiDashboardListDialogContent.spec.js | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/unit/WikiDashboardListDialogContent.spec.js diff --git a/tests/unit/WikiDashboardListDialogContent.spec.js b/tests/unit/WikiDashboardListDialogContent.spec.js new file mode 100644 index 00000000..cbb21ef3 --- /dev/null +++ b/tests/unit/WikiDashboardListDialogContent.spec.js @@ -0,0 +1,37 @@ +import { shallowMount } from '@vue/test-utils' +import WikiDashboardListDialogContent from '@/components/Pages/Dashboard/Components/WikiDashboardListDialogContent.vue' +require('./boilerplate.js') + +describe('WikiDashboardListDialogContent.vue', () => { + const propsData = { + formattedActiveFromDate: '11 November 2026', + wikiDomain: 'mywayordatway.wikibase.cloud', + wikiId: 1, + } + + it('renders the expiry message when there is no pending review', () => { + const wrapper = shallowMount(WikiDashboardListDialogContent, { + propsData: { + ...propsData, + hasPendingReview: false, + }, + }) + + expect(wrapper.text()).toContain('will be taken offline on 11 November 2026') + expect(wrapper.text()).not.toContain('is expecting a review') + expect(wrapper.text()).toContain('mywayordatway.wikibase.cloud') + }) + + it('renders the pending review message when a review is pending', () => { + const wrapper = shallowMount(WikiDashboardListDialogContent, { + propsData: { + ...propsData, + hasPendingReview: true, + }, + }) + + expect(wrapper.text()).toContain('is expecting a review') + expect(wrapper.text()).not.toContain('will be taken offline') + expect(wrapper.text()).toContain('mywayordatway.wikibase.cloud') + }) +}) From c20d117ff1d5f2ecc1ae99f9c2b5a9520413a434 Mon Sep 17 00:00:00 2001 From: Dat Date: Wed, 11 Nov 2026 16:42:54 +0100 Subject: [PATCH 2/7] Remove suspension date from the test to simplify it --- tests/unit/WikiDashboardListDialogContent.spec.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/unit/WikiDashboardListDialogContent.spec.js b/tests/unit/WikiDashboardListDialogContent.spec.js index cbb21ef3..a766e4b9 100644 --- a/tests/unit/WikiDashboardListDialogContent.spec.js +++ b/tests/unit/WikiDashboardListDialogContent.spec.js @@ -16,9 +16,7 @@ describe('WikiDashboardListDialogContent.vue', () => { hasPendingReview: false, }, }) - - expect(wrapper.text()).toContain('will be taken offline on 11 November 2026') - expect(wrapper.text()).not.toContain('is expecting a review') + expect(wrapper.text()).toContain('submit it for review') expect(wrapper.text()).toContain('mywayordatway.wikibase.cloud') }) @@ -31,7 +29,6 @@ describe('WikiDashboardListDialogContent.vue', () => { }) expect(wrapper.text()).toContain('is expecting a review') - expect(wrapper.text()).not.toContain('will be taken offline') expect(wrapper.text()).toContain('mywayordatway.wikibase.cloud') }) }) From 8d8172dedf039b4c589d7e7d7e6fcac66ddf1af1 Mon Sep 17 00:00:00 2001 From: Dat Date: Thu, 12 Nov 2026 13:46:25 +0100 Subject: [PATCH 3/7] combine expected rendered text with wiki domain --- tests/unit/WikiDashboardListDialogContent.spec.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/unit/WikiDashboardListDialogContent.spec.js b/tests/unit/WikiDashboardListDialogContent.spec.js index a766e4b9..5bdb0009 100644 --- a/tests/unit/WikiDashboardListDialogContent.spec.js +++ b/tests/unit/WikiDashboardListDialogContent.spec.js @@ -16,8 +16,7 @@ describe('WikiDashboardListDialogContent.vue', () => { hasPendingReview: false, }, }) - expect(wrapper.text()).toContain('submit it for review') - expect(wrapper.text()).toContain('mywayordatway.wikibase.cloud') + expect(wrapper.text()).toContain(`your Wikibase ${propsData.wikiDomain} will be taken offline`) }) it('renders the pending review message when a review is pending', () => { @@ -28,7 +27,6 @@ describe('WikiDashboardListDialogContent.vue', () => { }, }) - expect(wrapper.text()).toContain('is expecting a review') - expect(wrapper.text()).toContain('mywayordatway.wikibase.cloud') + expect(wrapper.text()).toContain(`Your Wikibase ${propsData.wikiDomain} is expecting a review`) }) }) From 1ec43e300491c88e6c9cc3fcfd5ff3fe75d0460b Mon Sep 17 00:00:00 2001 From: Ollie Hyde Date: Thu, 12 Nov 2026 14:19:07 +0000 Subject: [PATCH 4/7] add date to expiry message test --- tests/unit/WikiDashboardListDialogContent.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/WikiDashboardListDialogContent.spec.js b/tests/unit/WikiDashboardListDialogContent.spec.js index 5bdb0009..d2ac9a21 100644 --- a/tests/unit/WikiDashboardListDialogContent.spec.js +++ b/tests/unit/WikiDashboardListDialogContent.spec.js @@ -16,7 +16,9 @@ describe('WikiDashboardListDialogContent.vue', () => { hasPendingReview: false, }, }) - expect(wrapper.text()).toContain(`your Wikibase ${propsData.wikiDomain} will be taken offline`) + expect(wrapper.text()).toContain( + `your Wikibase ${propsData.wikiDomain} will be taken offline on ${propsData.formattedActiveFromDate}` + ) }) it('renders the pending review message when a review is pending', () => { From 21104200f75866f5888f3d9de89b671ae42182dd Mon Sep 17 00:00:00 2001 From: Ollie Hyde Date: Thu, 12 Nov 2026 14:21:36 +0000 Subject: [PATCH 5/7] make sure only the correct text is shown --- tests/unit/WikiDashboardListDialogContent.spec.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/WikiDashboardListDialogContent.spec.js b/tests/unit/WikiDashboardListDialogContent.spec.js index d2ac9a21..b193128f 100644 --- a/tests/unit/WikiDashboardListDialogContent.spec.js +++ b/tests/unit/WikiDashboardListDialogContent.spec.js @@ -9,7 +9,7 @@ describe('WikiDashboardListDialogContent.vue', () => { wikiId: 1, } - it('renders the expiry message when there is no pending review', () => { + it('renders only the expiry message when there is no pending review', () => { const wrapper = shallowMount(WikiDashboardListDialogContent, { propsData: { ...propsData, @@ -19,9 +19,10 @@ describe('WikiDashboardListDialogContent.vue', () => { expect(wrapper.text()).toContain( `your Wikibase ${propsData.wikiDomain} will be taken offline on ${propsData.formattedActiveFromDate}` ) + expect(wrapper.text()).not.toContain('is expecting a review') }) - it('renders the pending review message when a review is pending', () => { + it('renders only the pending review message when a review is pending', () => { const wrapper = shallowMount(WikiDashboardListDialogContent, { propsData: { ...propsData, @@ -30,5 +31,6 @@ describe('WikiDashboardListDialogContent.vue', () => { }) expect(wrapper.text()).toContain(`Your Wikibase ${propsData.wikiDomain} is expecting a review`) + expect(wrapper.text()).not.toContain('will be taken offline') }) }) From dd0b0ebbdbf7ecf7e544aa0fa737a9a47337a1d9 Mon Sep 17 00:00:00 2001 From: Ollie Hyde Date: Thu, 12 Nov 2026 14:22:25 +0000 Subject: [PATCH 6/7] make newline between test setup and test assertions consistent --- tests/unit/WikiDashboardListDialogContent.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/WikiDashboardListDialogContent.spec.js b/tests/unit/WikiDashboardListDialogContent.spec.js index b193128f..52a25dc3 100644 --- a/tests/unit/WikiDashboardListDialogContent.spec.js +++ b/tests/unit/WikiDashboardListDialogContent.spec.js @@ -16,6 +16,7 @@ describe('WikiDashboardListDialogContent.vue', () => { hasPendingReview: false, }, }) + expect(wrapper.text()).toContain( `your Wikibase ${propsData.wikiDomain} will be taken offline on ${propsData.formattedActiveFromDate}` ) From 44a7c18428a7826f91844b200683b282a07b142f Mon Sep 17 00:00:00 2001 From: Ollie Hyde Date: Thu, 12 Nov 2026 14:29:25 +0000 Subject: [PATCH 7/7] fix linting --- tests/unit/WikiDashboardListDialogContent.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/WikiDashboardListDialogContent.spec.js b/tests/unit/WikiDashboardListDialogContent.spec.js index 52a25dc3..f9450793 100644 --- a/tests/unit/WikiDashboardListDialogContent.spec.js +++ b/tests/unit/WikiDashboardListDialogContent.spec.js @@ -18,7 +18,7 @@ describe('WikiDashboardListDialogContent.vue', () => { }) expect(wrapper.text()).toContain( - `your Wikibase ${propsData.wikiDomain} will be taken offline on ${propsData.formattedActiveFromDate}` + `your Wikibase ${propsData.wikiDomain} will be taken offline on ${propsData.formattedActiveFromDate}`, ) expect(wrapper.text()).not.toContain('is expecting a review') })