From a36930a7164cdbd29ee213543a5ff8ea7e4a4cd7 Mon Sep 17 00:00:00 2001 From: Alexandre Monney Date: Mon, 3 Feb 2025 15:29:22 +0100 Subject: [PATCH] test?(admin): add missing test on NPS --- .../information-section-view-test.gjs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/admin/tests/integration/components/organizations/information-section-view-test.gjs b/admin/tests/integration/components/organizations/information-section-view-test.gjs index ef3537a19c2..67ca978b03a 100644 --- a/admin/tests/integration/components/organizations/information-section-view-test.gjs +++ b/admin/tests/integration/components/organizations/information-section-view-test.gjs @@ -239,6 +239,7 @@ module('Integration | Component | organizations/information-section-view', funct assert.dom(screen.getByText('Archivée le 22/02/2022 par Rob Lochon.')).exists(); }); }); + module('when organization is parent', function () { test('it should display parent label', async function (assert) { //given @@ -457,6 +458,52 @@ module('Integration | Component | organizations/information-section-view', funct }); }); }); + + module('Net Promoter Score', function () { + module('when NPS is enabled', function () { + test('should display a link to formNPSUrl', async function (assert) { + // given + const NPSUrl = 'http://example.net'; + const organization = EmberObject.create({ + features: { + SHOW_NPS: { active: true, params: { formNPSUrl: NPSUrl } }, + }, + }); + + // when + const screen = await render(); + + // then + assert.ok( + screen.getByText(`${t('components.organizations.information-section-view.features.SHOW_NPS')} :`), + ); + assert.ok(screen.getByRole('link', { name: NPSUrl })); + }); + }); + + module('when NPS is not enabled', function () { + test('should display text with no and not the link', async function (assert) { + // given + const NPSUrl = 'http://example.net'; + const organization = EmberObject.create({ + features: { + SHOW_NPS: { active: false, params: { formNPSUrl: NPSUrl } }, + }, + }); + + // when + const screen = await render(); + + // then + assert.ok( + screen.getByText( + `${t('components.organizations.information-section-view.features.SHOW_NPS')} : ${t('common.words.no')}`, + ), + ); + assert.notOk(screen.queryByRole('link', { name: NPSUrl })); + }); + }); + }); }); });