Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 3570 - feature flag in front of grant activity preference #3606

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions packages/client/src/views/MyProfileView.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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', () => {
Expand Down Expand Up @@ -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],
Expand Down
7 changes: 4 additions & 3 deletions packages/client/src/views/MyProfileView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

<script>
import { mapGetters, mapActions } from 'vuex';
import { shareTerminologyEnabled } from '@/helpers/featureFlags';
import { shareTerminologyEnabled, followNotesEnabled } from '@/helpers/featureFlags';
import EditUserModal from '@/components/Modals/EditUser.vue';
import UserAvatar from '@/components/UserAvatar.vue';

Expand All @@ -83,6 +83,7 @@ export default {
},
data() {
const shareTerminologyEnabledFlag = shareTerminologyEnabled() === true;
const followNotesEnabledFlag = followNotesEnabled() === true;
const grantAssignmentDescription = 'Send me notifications if a grant has been assigned to my USDR Grants team.';
const grantShareDescription = 'Send me an email notification when someone shares a grant with my team.';

Expand All @@ -98,11 +99,11 @@ export default {
key: 'GRANT_ASSIGNMENT',
description: shareTerminologyEnabledFlag ? grantShareDescription : grantAssignmentDescription,
},
{
...(followNotesEnabledFlag ? [{
name: 'Grant Activity',
key: 'GRANT_ACTIVITY',
description: 'Send me a daily summary of new activity for grants that I follow.',
},
}] : []),
],
breadcrumb_items: [
{
Expand Down
Loading