From 12ed2303f0c419615e2974bbb184e37517cb9402 Mon Sep 17 00:00:00 2001 From: Peter Miller Date: Thu, 10 Oct 2024 10:30:49 -0400 Subject: [PATCH] fix: 3570 - feature flag in front of grant activity preference (#3606) --- .../client/src/views/MyProfileView.spec.js | 30 +++++++++++++++++-- packages/client/src/views/MyProfileView.vue | 7 +++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/packages/client/src/views/MyProfileView.spec.js b/packages/client/src/views/MyProfileView.spec.js index e6f8f0c33..59d77430f 100644 --- a/packages/client/src/views/MyProfileView.spec.js +++ b/packages/client/src/views/MyProfileView.spec.js @@ -4,7 +4,7 @@ import { import { shallowMount } from '@vue/test-utils'; import { createStore } from 'vuex'; import MyProfileView from '@/views/MyProfileView.vue'; -import { shareTerminologyEnabled } from '@/helpers/featureFlags'; +import { shareTerminologyEnabled, followNotesEnabled } from '@/helpers/featureFlags'; describe('MyProfileView.vue', () => { const store = createStore({ @@ -24,6 +24,7 @@ describe('MyProfileView.vue', () => { vi.mock('@/helpers/featureFlags', async (importOriginal) => ({ ...await importOriginal(), shareTerminologyEnabled: vi.fn(), + followNotesEnabled: vi.fn(), })); describe('when share terminology flag is off', () => { @@ -64,8 +65,31 @@ describe('MyProfileView.vue', () => { }); }); - describe('grant activity preference', () => { - it('should show grant activity terminology', () => { + describe('when follow notes flag is off', () => { + beforeEach(() => { + vi.mocked(followNotesEnabled).mockReturnValue(false); + }); + + it('should not show grant activity preference', () => { + const wrapper = shallowMount(MyProfileView, { + global: { + plugins: [store], + }, + }); + const text = wrapper.text(); + expect(text).not.toContain('Grant Activity'); + expect(text).not.toContain( + 'Send me a daily summary of new activity for grants that I follow.', + ); + }); + }); + + describe('when follow notes flag is on', () => { + beforeEach(() => { + vi.mocked(followNotesEnabled).mockReturnValue(true); + }); + + it('should show grant activity preference', () => { const wrapper = shallowMount(MyProfileView, { global: { plugins: [store], diff --git a/packages/client/src/views/MyProfileView.vue b/packages/client/src/views/MyProfileView.vue index 8a1b9d16a..82dfd9a87 100644 --- a/packages/client/src/views/MyProfileView.vue +++ b/packages/client/src/views/MyProfileView.vue @@ -72,7 +72,7 @@