Skip to content

Commit a36930a

Browse files
test?(admin): add missing test on NPS
1 parent de2f75d commit a36930a

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

admin/tests/integration/components/organizations/information-section-view-test.gjs

+47
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ module('Integration | Component | organizations/information-section-view', funct
239239
assert.dom(screen.getByText('Archivée le 22/02/2022 par Rob Lochon.')).exists();
240240
});
241241
});
242+
242243
module('when organization is parent', function () {
243244
test('it should display parent label', async function (assert) {
244245
//given
@@ -457,6 +458,52 @@ module('Integration | Component | organizations/information-section-view', funct
457458
});
458459
});
459460
});
461+
462+
module('Net Promoter Score', function () {
463+
module('when NPS is enabled', function () {
464+
test('should display a link to formNPSUrl', async function (assert) {
465+
// given
466+
const NPSUrl = 'http://example.net';
467+
const organization = EmberObject.create({
468+
features: {
469+
SHOW_NPS: { active: true, params: { formNPSUrl: NPSUrl } },
470+
},
471+
});
472+
473+
// when
474+
const screen = await render(<template><InformationSectionView @organization={{organization}} /></template>);
475+
476+
// then
477+
assert.ok(
478+
screen.getByText(`${t('components.organizations.information-section-view.features.SHOW_NPS')} :`),
479+
);
480+
assert.ok(screen.getByRole('link', { name: NPSUrl }));
481+
});
482+
});
483+
484+
module('when NPS is not enabled', function () {
485+
test('should display text with no and not the link', async function (assert) {
486+
// given
487+
const NPSUrl = 'http://example.net';
488+
const organization = EmberObject.create({
489+
features: {
490+
SHOW_NPS: { active: false, params: { formNPSUrl: NPSUrl } },
491+
},
492+
});
493+
494+
// when
495+
const screen = await render(<template><InformationSectionView @organization={{organization}} /></template>);
496+
497+
// then
498+
assert.ok(
499+
screen.getByText(
500+
`${t('components.organizations.information-section-view.features.SHOW_NPS')} : ${t('common.words.no')}`,
501+
),
502+
);
503+
assert.notOk(screen.queryByRole('link', { name: NPSUrl }));
504+
});
505+
});
506+
});
460507
});
461508
});
462509

0 commit comments

Comments
 (0)