diff --git a/packages/client/public/deploy-config.js b/packages/client/public/deploy-config.js index ba9e594442..1f6284675d 100644 --- a/packages/client/public/deploy-config.js +++ b/packages/client/public/deploy-config.js @@ -21,5 +21,6 @@ window.APP_CONFIG.overrideFeatureFlag = (flagName, overrideValue) => { // configuring the `website_feature_flags` input variable in Terraform (see `terraform/*.tfvars`). window.APP_CONFIG.featureFlags = { useNewTable: true, - myProfileEnabled: true + myProfileEnabled: true, + newTerminologyEnabled: true, }; diff --git a/packages/client/src/components/GrantsTableNext.vue b/packages/client/src/components/GrantsTableNext.vue index c49f4d5abe..bb24c25315 100644 --- a/packages/client/src/components/GrantsTableNext.vue +++ b/packages/client/src/components/GrantsTableNext.vue @@ -75,6 +75,7 @@ diff --git a/packages/client/src/views/Agencies.vue b/packages/client/src/views/Teams.vue similarity index 51% rename from packages/client/src/views/Agencies.vue rename to packages/client/src/views/Teams.vue index ee7a667ac1..929e9764cf 100644 --- a/packages/client/src/views/Agencies.vue +++ b/packages/client/src/views/Teams.vue @@ -1,18 +1,18 @@ - - - + + + @@ -38,15 +38,16 @@ import { mapActions, mapGetters } from 'vuex'; -import EditAgencyModal from '@/components/Modals/EditAgency.vue'; -import AddAgencyModal from '@/components/Modals/AddAgency.vue'; -import ImportAgenciesModal from '@/components/Modals/ImportAgencies.vue'; +import EditTeamModal from '@/components/Modals/EditTeam.vue'; +import AddTeamModal from '@/components/Modals/AddTeam.vue'; +import ImportTeamsModal from '@/components/Modals/ImportTeams.vue'; +import { newTerminologyEnabled } from '@/helpers/featureFlags'; export default { components: { - EditAgencyModal, - AddAgencyModal, - ImportAgenciesModal, + EditTeamModal, + AddTeamModal, + ImportTeamsModal, }, data() { return { @@ -78,10 +79,10 @@ export default { label: 'Actions', }, ], - showAddAgencyModal: false, - showEditAgencyModal: false, - showUploadAgenciesModal: false, - editingAgency: null, + showAddTeamModal: false, + showEditTeamModal: false, + showUploadTeamsModal: false, + editingTeam: null, }; }, mounted() { @@ -89,37 +90,40 @@ export default { }, computed: { ...mapGetters({ - agencies: 'agencies/agencies', + teams: 'agencies/agencies', userRole: 'users/userRole', - selectedAgency: 'users/selectedAgency', + selectedTeam: 'users/selectedAgency', }), - formattedAgencies() { - return this.agencies.map((agency) => ({ - ...agency, + newTerminologyEnabled() { + return newTerminologyEnabled(); + }, + formattedTeams() { + return this.teams.map((team) => ({ + ...team, })); }, }, watch: { - selectedAgency() { + selectedTeam() { this.setup(); }, }, methods: { ...mapActions({ - fetchAgencies: 'agencies/fetchAgencies', + fetchTeams: 'agencies/fetchAgencies', }), setup() { - this.fetchAgencies(); + this.fetchTeams(); }, - openEditAgencyModal(agency) { - this.editingAgency = agency; - this.showEditAgencyModal = true; + openEditTeamModal(team) { + this.editingTeam = team; + this.showEditTeamModal = true; }, - openAddAgencyModal() { - this.showAddAgencyModal = true; + openAddTeamModal() { + this.showAddTeamModal = true; }, - openUploadAgenciesModal() { - this.showUploadAgenciesModal = true; + openUploadTeamsModal() { + this.showUploadTeamsModal = true; }, }, }; diff --git a/packages/client/src/views/Tenants.vue b/packages/client/src/views/Tenants.vue deleted file mode 100644 index 32a01eadb5..0000000000 --- a/packages/client/src/views/Tenants.vue +++ /dev/null @@ -1,95 +0,0 @@ - - - diff --git a/packages/client/src/views/Users.vue b/packages/client/src/views/Users.vue index 4d7e7f9e41..17448b9a4a 100644 --- a/packages/client/src/views/Users.vue +++ b/packages/client/src/views/Users.vue @@ -33,6 +33,7 @@ import { mapActions, mapGetters } from 'vuex'; import AddUserModal from '@/components/Modals/AddUser.vue'; import ImportUsersModal from '@/components/Modals/ImportUsers.vue'; +import { newTerminologyEnabled } from '@/helpers/featureFlags'; export default { components: { @@ -56,10 +57,12 @@ export default { { key: 'agency_name', sortable: true, + label: `${newTerminologyEnabled ? 'Team' : 'Agency'} Name`, }, { key: 'agency_abbrv', sortable: true, + label: `${newTerminologyEnabled ? 'Team' : 'Agency'} Abbrv`, }, { key: 'created_at', @@ -88,6 +91,9 @@ export default { role: user.role.name, })); }, + newTerminologyEnabled() { + return newTerminologyEnabled(); + }, }, watch: { selectedAgency() { diff --git a/packages/client/tests/unit/components/Layout.spec.js b/packages/client/tests/unit/components/Layout.spec.js new file mode 100644 index 0000000000..89088c9aca --- /dev/null +++ b/packages/client/tests/unit/components/Layout.spec.js @@ -0,0 +1,169 @@ +import { expect } from 'chai'; + +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import Vuex from 'vuex'; +import Layout from '@/components/Layout.vue'; + +const localVue = createLocalVue(); +localVue.use(Vuex); + +let store; +let wrapper; + +afterEach(() => { + store = undefined; + wrapper = undefined; +}); +const defaultRoute = { + meta: { + hideLayoutTabs: false, + }, +}; +const stubs = ['b-nav-item-dropdown', 'b-navbar', 'b-navbar-nav', 'b-collapse', 'b-navbar-brand', 'b-img', 'b-nav-item', 'b-dropdown-item-button', 'b-col', 'b-nav', 'router-view', 'b-badge', 'b-nav-text']; +const noOpGetters = { + 'users/selectedAgency': () => {}, + 'users/loggedInUser': () => {}, + 'users/userRole': () => {}, + 'alerts/alerts': () => [], +}; + +describe('Layout.vue', () => { + describe('when Layout view is loaded', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { ...noOpGetters }, + }); + wrapper = shallowMount(Layout, { + localVue, + store, + mocks: { + $route: defaultRoute, + }, + stubs, + computed: { + newTerminologyEnabled: () => true, + }, + }); + }); + it('should show the Grants heading', () => { + const layoutHeader = wrapper.get('h3'); + expect(layoutHeader.text()).to.include('Grants Identification Tool'); + }); + it('should show My Grants tab', () => { + const navItem = wrapper.get('[to="/my-grants"]'); + expect(navItem.text()).to.eql('My Grants'); + }); + it('should show Browse Grants tab', () => { + const navItem = wrapper.get('[to="/grants"]'); + expect(navItem.text()).to.eql('Browse Grants'); + }); + it('should show Dashboard tab', () => { + const navItem = wrapper.get('[to="/dashboard"]'); + expect(navItem.text()).to.eql('Dashboard'); + }); + it('should show Teams tab', () => { + const navItem = wrapper.get('[to="/teams"]'); + expect(navItem.text()).to.eql('Teams'); + }); + }); + describe('when user is logged in', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + ...noOpGetters, + 'users/loggedInUser': () => ({}), + }, + }); + wrapper = shallowMount(Layout, { + localVue, + store, + mocks: { + $route: defaultRoute, + }, + stubs, + }); + }); + it('should have a dropdown', () => { + wrapper.get('b-nav-item-dropdown-stub'); + }); + it('should have the correct options', () => { + const options = wrapper.findAllComponents('b-dropdown-item-button-stub'); + expect(options.length).to.eql(4); + expect(options.at(0).text()).to.eql('Settings'); + expect(options.at(1).text()).to.eql('Give Feedback'); + expect(options.at(2).text()).to.eql('Training Guide'); + expect(options.at(3).text()).to.eql('Sign Out'); + }); + }); + describe('when user is admin', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + ...noOpGetters, + 'users/userRole': () => 'admin', + }, + }); + wrapper = shallowMount(Layout, { + localVue, + store, + mocks: { + $route: defaultRoute, + }, + stubs, + }); + }); + + it('should show Users tab', () => { + const navItem = wrapper.get('[to="/users"]'); + expect(navItem.text()).to.eql('Users'); + }); + }); + describe('when user is super admin', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + ...noOpGetters, + 'users/loggedInUser': () => ({ isUSDRSuperAdmin: true }), + }, + }); + wrapper = shallowMount(Layout, { + localVue, + store, + mocks: { + $route: defaultRoute, + }, + stubs, + computed: { + newTerminologyEnabled: () => true, + }, + }); + }); + + it('should show Organizations tab', () => { + const navItem = wrapper.get('b-nav-item-stub[to="/organizations"]'); + expect(navItem.text()).to.eql('Organizations'); + }); + }); + describe('when a team is selected', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + ...noOpGetters, + 'users/selectedAgency': () => ({ name: 'Test Team Name' }), + }, + }); + wrapper = shallowMount(Layout, { + localVue, + store, + mocks: { + $route: defaultRoute, + }, + stubs, + }); + }); + it('should show the team name badge', () => { + const badge = wrapper.get('b-badge-stub'); + expect(badge.text()).to.eql('Test Team Name'); + }); + }); +}); diff --git a/packages/client/tests/unit/components/Modals/AddOrganization.spec.js b/packages/client/tests/unit/components/Modals/AddOrganization.spec.js new file mode 100644 index 0000000000..81313c8649 --- /dev/null +++ b/packages/client/tests/unit/components/Modals/AddOrganization.spec.js @@ -0,0 +1,34 @@ +import { expect } from 'chai'; +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import Vuex from 'vuex'; +import AddOrganization from '@/components/Modals/AddOrganization.vue'; +import Vuelidate from 'vuelidate'; + +const localVue = createLocalVue(); +localVue.use(Vuex); +localVue.use(Vuelidate); + +let wrapper; +const stubs = ['b-modal', 'b-form-group', 'b-form-input']; + +afterEach(() => { + wrapper = undefined; +}); + +describe('AddOrganization.vue', () => { + describe('when the modal is loaded', () => { + beforeEach(() => { + wrapper = shallowMount(AddOrganization, { + localVue, + stubs, + computed: { + newTerminologyEnabled: () => true, + }, + }); + }); + it('should have the title Add Organization', () => { + const heading = wrapper.get('#add-tenant-modal'); + expect(heading.attributes().title).to.eql('Add Organization'); + }); + }); +}); diff --git a/packages/client/tests/unit/components/Modals/AddTeam.spec.js b/packages/client/tests/unit/components/Modals/AddTeam.spec.js new file mode 100644 index 0000000000..8254045f58 --- /dev/null +++ b/packages/client/tests/unit/components/Modals/AddTeam.spec.js @@ -0,0 +1,42 @@ +import { expect } from 'chai'; +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import Vuex from 'vuex'; +import Vuelidate from 'vuelidate'; +import AddTeam from '@/components/Modals/AddTeam.vue'; + +const localVue = createLocalVue(); +localVue.use(Vuex); +localVue.use(Vuelidate); + +let store; +let wrapper; +const stubs = ['b-modal', 'v-select', 'b-form-group', 'b-form-input']; + +afterEach(() => { + store = undefined; + wrapper = undefined; +}); + +describe('AddTeam.vue', () => { + describe('when the modal is loaded', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + 'users/loggedInUser': () => {}, + }, + }); + wrapper = shallowMount(AddTeam, { + localVue, + store, + stubs, + computed: { + newTerminologyEnabled: () => true, + }, + }); + }); + it('should have the title Add Team', () => { + const heading = wrapper.get('#add-agency-modal'); + expect(heading.attributes().title).to.eql('Add Team'); + }); + }); +}); diff --git a/packages/client/tests/unit/components/Modals/EditOrganization.spec.js b/packages/client/tests/unit/components/Modals/EditOrganization.spec.js new file mode 100644 index 0000000000..46ba999db6 --- /dev/null +++ b/packages/client/tests/unit/components/Modals/EditOrganization.spec.js @@ -0,0 +1,34 @@ +import { expect } from 'chai'; +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import Vuex from 'vuex'; +import Vuelidate from 'vuelidate'; +import EditOrganization from '@/components/Modals/EditOrganization.vue'; + +const localVue = createLocalVue(); +localVue.use(Vuex); +localVue.use(Vuelidate); + +let wrapper; +const stubs = ['b-modal', 'b-form-group', 'b-form-input']; + +afterEach(() => { + wrapper = undefined; +}); + +describe('EditOrganization.vue', () => { + describe('when the modal is loaded', () => { + beforeEach(() => { + wrapper = shallowMount(EditOrganization, { + localVue, + stubs, + computed: { + newTerminologyEnabled: () => true, + }, + }); + }); + it('should have the title Edit Organization', () => { + const heading = wrapper.get('#edit-tenant-modal'); + expect(heading.attributes().title).to.eql('Edit Organization'); + }); + }); +}); diff --git a/packages/client/tests/unit/components/Modals/EditTeam.spec.js b/packages/client/tests/unit/components/Modals/EditTeam.spec.js new file mode 100644 index 0000000000..6535d9dd62 --- /dev/null +++ b/packages/client/tests/unit/components/Modals/EditTeam.spec.js @@ -0,0 +1,47 @@ +import { expect } from 'chai'; +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import Vuex from 'vuex'; +import Vuelidate from 'vuelidate'; +import EditTeam from '@/components/Modals/EditTeam.vue'; + +const localVue = createLocalVue(); +localVue.use(Vuex); +localVue.use(Vuelidate); + +let store; +let wrapper; +const stubs = [ + 'b-modal', 'v-select', 'b-form-group', 'b-form-input', 'b-button', 'b-tooltip', +]; +const noOpGetters = { + 'agencies/agencies': () => [], + 'users/userRole': () => {}, +}; +afterEach(() => { + store = undefined; + wrapper = undefined; +}); + +describe('EditTeam.vue', () => { + describe('when the modal is loaded', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + ...noOpGetters, + }, + }); + wrapper = shallowMount(EditTeam, { + localVue, + store, + stubs, + computed: { + newTerminologyEnabled: () => true, + }, + }); + }); + it('should have the title Edit Team', () => { + const heading = wrapper.get('#edit-agency-modal'); + expect(heading.attributes().title).to.eql('Edit Team'); + }); + }); +}); diff --git a/packages/client/tests/unit/views/Agencies.spec.js b/packages/client/tests/unit/views/Agencies.spec.js deleted file mode 100644 index f4aeac6cd2..0000000000 --- a/packages/client/tests/unit/views/Agencies.spec.js +++ /dev/null @@ -1,103 +0,0 @@ -import { expect } from 'chai'; - -import { createLocalVue, shallowMount } from '@vue/test-utils'; -import Vuex from 'vuex'; -import Agencies from '@/views/Agencies.vue'; - -const localVue = createLocalVue(); -localVue.use(Vuex); - -let store; -let wrapper; - -afterEach(() => { - store = undefined; - wrapper = undefined; -}); - -describe('Agencies.vue', () => { - describe('when a non-admin loads the page', () => { - beforeEach(() => { - store = new Vuex.Store({ - getters: { - 'users/userRole': () => 'not an admin', - 'agencies/agencies': () => [], - 'users/selectedAgency': () => undefined, - 'agencies/fetchAgencies': () => [], - }, - }); - wrapper = shallowMount(Agencies, { - store, - localVue, - stubs: ['b-row', 'b-col', 'b-button', 'b-table', 'b-icon'], - }); - }); - it('should not allow user to import agencies', () => { - const bulkImportButtons = wrapper.findAll('#bulkAgencyImportButton'); - expect(bulkImportButtons.length).to.eql(0); - }); - it('should not allow user to add an agency', () => { - const addButtons = wrapper.findAll('#addAgencyButton'); - expect(addButtons.length).to.eql(0); - }); - it('should not allow user to edit an agency', () => { - const editButtons = wrapper.findAll('[icon="pencil-fill"]'); - expect(editButtons.length).to.eql(0); - }); - }); - describe('when an admin loads the page', () => { - describe('and there are no agencies', () => { - beforeEach(() => { - store = new Vuex.Store({ - getters: { - 'users/userRole': () => 'admin', - 'agencies/agencies': () => [], - 'users/selectedAgency': () => undefined, - 'agencies/fetchAgencies': () => [], - }, - }); - wrapper = shallowMount(Agencies, { - store, - localVue, - }); - }); - it('should allow user to import agencies', () => { - const bulkImportButton = wrapper.get('#bulkAgencyImportButton'); - expect(bulkImportButton.text()).to.include('Bulk Import'); - }); - it('should allow user to add an agency', () => { - const addButton = wrapper.get('#addAgencyButton'); - expect(addButton.text()).to.include('Add'); - }); - it.skip('should not be able to edit an agency', () => { - const editButtons = wrapper.findAll('[icon="pencil-fill"]'); - expect(editButtons.length).to.eql(0); - }); - }); - describe('and there is one agency', () => { - beforeEach(() => { - const agencies = [ - { - id: 1, code: '001', name: 'Agency 1', abbreviation: 'A1', - }, - ]; - store = new Vuex.Store({ - getters: { - 'users/userRole': () => 'admin', - 'agencies/agencies': () => agencies, - 'users/selectedAgency': () => undefined, - 'agencies/fetchAgencies': () => agencies, - }, - }); - wrapper = shallowMount(Agencies, { - store, - localVue, - }); - }); - it.skip('should allow user to edit an agency', () => { - const editButtons = wrapper.findAll('[icon="pencil-fill"]'); - expect(editButtons.length).to.eql(1); - }); - }); - }); -}); diff --git a/packages/client/tests/unit/views/Dashboard.spec.js b/packages/client/tests/unit/views/Dashboard.spec.js new file mode 100644 index 0000000000..a065fcdeca --- /dev/null +++ b/packages/client/tests/unit/views/Dashboard.spec.js @@ -0,0 +1,70 @@ +import { expect } from 'chai'; + +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import Vuex from 'vuex'; +import Dashboard from '@/views/Dashboard.vue'; + +const localVue = createLocalVue(); +localVue.use(Vuex); + +let store; +let wrapper; +const stubs = ['b-row', 'b-col', 'b-table', 'b-button', 'b-card', 'b-link', 'b-container']; +const noOpGetters = { + 'dashboard/totalGrants': () => [], + 'dashboard/totalGrantsMatchingAgencyCriteria': () => [], + 'dashboard/totalViewedGrants': () => [], + 'grants/totalInterestedGrants': () => [], + 'grants/totalUpcomingGrants': () => [], + 'dashboard/grantsCreatedInTimeframe': () => [], + 'dashboard/grantsCreatedInTimeframeMatchingCriteria': () => [], + 'dashboard/grantsUpdatedInTimeframe': () => [], + 'dashboard/grantsUpdatedInTimeframeMatchingCriteria': () => [], + 'dashboard/totalInterestedGrantsByAgencies': () => [], + 'users/selectedAgency': () => undefined, + 'grants/closestGrants': () => [], + 'grants/grants': () => [], + 'grants/grantsInterested': () => [], + 'users/agency': () => undefined, + 'grants/currentGrant': () => undefined, +}; +const noOpActions = { + 'dashboard/fetchDashboard': () => {}, + 'grants/fetchGrantsInterested': () => {}, + 'grants/fetchClosestGrants': () => {}, +}; +afterEach(() => { + store = undefined; + wrapper = undefined; +}); + +describe('Dashboard.vue', () => { + describe('when user has no interested grants"', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + ...noOpGetters, + }, + actions: { + ...noOpActions, + }, + }); + wrapper = shallowMount(Dashboard, { + store, + localVue, + stubs, + computed: { + newTerminologyEnabled: () => true, + }, + }); + }); + it('should show the no recent activity message', () => { + const noRecentActivityMessage = wrapper.find('#noRecentActivityMessage'); + expect(noRecentActivityMessage.text()).to.include('Your team has no recent activity.'); + }); + it('should show the no recent activity message', () => { + const noRecentActivityMessage = wrapper.find('#noUpcomingCloseDates'); + expect(noRecentActivityMessage.text()).to.include('Your team has no upcoming close dates.'); + }); + }); +}); diff --git a/packages/client/tests/unit/views/Organizations.spec.js b/packages/client/tests/unit/views/Organizations.spec.js new file mode 100644 index 0000000000..fbd1699cac --- /dev/null +++ b/packages/client/tests/unit/views/Organizations.spec.js @@ -0,0 +1,50 @@ +import { expect } from 'chai'; + +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import Vuex from 'vuex'; +import Organizations from '@/views/Organizations.vue'; + +const localVue = createLocalVue(); +localVue.use(Vuex); + +let store; +let wrapper; +const stubs = ['b-row', 'b-col', 'b-button', 'b-table', 'b-icon']; +const noOpGetters = { + 'users/selectedAgency': () => {}, + 'tenants/tenants': () => [], +}; +const noOpActions = { + 'tenants/fetchTenants': () => {}, +}; +afterEach(() => { + store = undefined; + wrapper = undefined; +}); + +describe('Organizations.vue', () => { + describe('when the view is loaded', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + ...noOpGetters, + }, + actions: { + ...noOpActions, + }, + }); + wrapper = shallowMount(Organizations, { + store, + localVue, + stubs, + computed: { + newTerminologyEnabled: () => true, + }, + }); + }); + it('should show the Organizations heading', () => { + const heading = wrapper.find('h2'); + expect(heading.text()).to.eql('Organizations'); + }); + }); +}); diff --git a/packages/client/tests/unit/views/Teams.spec.js b/packages/client/tests/unit/views/Teams.spec.js new file mode 100644 index 0000000000..043b6f1d0e --- /dev/null +++ b/packages/client/tests/unit/views/Teams.spec.js @@ -0,0 +1,126 @@ +import { expect } from 'chai'; + +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import Vuex from 'vuex'; +import Teams from '@/views/Teams.vue'; + +const localVue = createLocalVue(); +localVue.use(Vuex); + +let store; +let wrapper; +const stubs = ['b-row', 'b-col', 'b-button', 'b-table', 'b-icon']; +const noOpGetters = { + 'agencies/agencies': () => [], + 'users/userRole': () => undefined, + 'users/selectedAgency': () => undefined, +}; +const noOpActions = { + 'agencies/fetchAgencies': () => {}, +}; +afterEach(() => { + store = undefined; + wrapper = undefined; +}); + +describe('Teams.vue', () => { + describe('when a non-admin loads the page', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + ...noOpGetters, + 'users/userRole': () => 'not an admin', + }, + actions: { + ...noOpActions, + }, + }); + wrapper = shallowMount(Teams, { + store, + localVue, + stubs, + computed: { + newTerminologyEnabled: () => true, + }, + }); + }); + it('should show the Teams heading', () => { + const heading = wrapper.find('h2'); + expect(heading.text()).to.eql('Teams'); + }); + it('should not allow user to import teams', () => { + const bulkImportButtons = wrapper.findAll('#bulkTeamImportButton'); + expect(bulkImportButtons.length).to.eql(0); + }); + it('should not allow user to add a team', () => { + const addButtons = wrapper.findAll('#addTeamButton'); + expect(addButtons.length).to.eql(0); + }); + it('should not allow user to edit a team', () => { + const editButtons = wrapper.findAll('[icon="pencil-fill"]'); + expect(editButtons.length).to.eql(0); + }); + }); + describe('when an admin loads the page', () => { + describe('and there are no teams', () => { + beforeEach(() => { + store = new Vuex.Store({ + getters: { + ...noOpGetters, + 'users/userRole': () => 'admin', + 'users/selectedAgency': () => undefined, + }, + actions: { + ...noOpActions, + }, + }); + wrapper = shallowMount(Teams, { + store, + localVue, + stubs, + }); + }); + it('should allow user to import teams', () => { + const bulkImportButton = wrapper.get('#bulkTeamImportButton'); + expect(bulkImportButton.text()).to.include('Bulk Import'); + }); + it('should allow user to add a team', () => { + const addButton = wrapper.get('#addTeamButton'); + expect(addButton.text()).to.include('Add'); + }); + it.skip('should not be able to edit a team', () => { + const editButtons = wrapper.findAll('[icon="pencil-fill"]'); + expect(editButtons.length).to.eql(0); + }); + }); + describe('and there is one team', () => { + beforeEach(() => { + const teams = [ + { + id: 1, code: '001', name: 'Team 1', abbreviation: 'A1', + }, + ]; + store = new Vuex.Store({ + getters: { + ...noOpGetters, + 'users/userRole': () => 'admin', + 'agencies/agencies': () => teams, + 'users/selectedAgency': () => undefined, + }, + actions: { + ...noOpActions, + }, + }); + wrapper = shallowMount(Teams, { + store, + localVue, + stubs, + }); + }); + it.skip('should allow user to edit a team', () => { + const editButtons = wrapper.findAll('[icon="pencil-fill"]'); + expect(editButtons.length).to.eql(1); + }); + }); + }); +}); diff --git a/packages/server/__tests__/api/grants.test.js b/packages/server/__tests__/api/grants.test.js index c930d1228c..3470860a88 100644 --- a/packages/server/__tests__/api/grants.test.js +++ b/packages/server/__tests__/api/grants.test.js @@ -701,7 +701,7 @@ HHS-2021-IHS-TPI-0001,Community Health Aide Program: Tribal Planning &`; }); context('GET /exportCSVRecentActivities', () => { it('produces the expected column headers', async () => { - const expectedCsvHeaders = 'Date,Agency,Grant,Status Code,Grant Assigned By,Email'; + const expectedCsvHeaders = 'Date,Team,Grant,Status Code,Grant Assigned By,Email'; const agencyId = agencies.own; const role = fetchOptions.staff; diff --git a/packages/server/src/routes/grants.js b/packages/server/src/routes/grants.js index de9f645725..d96409bc9a 100755 --- a/packages/server/src/routes/grants.js +++ b/packages/server/src/routes/grants.js @@ -278,7 +278,7 @@ router.get('/exportCSVRecentActivities', requireUser, async (req, res) => { const formattedData = data.map((grant) => ({ ...grant, date: new Date(grant.created_at).toLocaleDateString('en-US'), - agency: grant.name, + team: grant.name, grant: grant.title, status_code: grant.status_code, name: users[grant.assigned_by]?.name, @@ -293,7 +293,7 @@ router.get('/exportCSVRecentActivities', requireUser, async (req, res) => { header: true, columns: [ { key: 'date', header: 'Date' }, - { key: 'agency', header: 'Agency' }, + { key: 'team', header: 'Team' }, { key: 'grant', header: 'Grant' }, { key: 'status_code', header: 'Status Code' }, { key: 'name', header: 'Grant Assigned By' }, diff --git a/terraform/prod.tfvars b/terraform/prod.tfvars index 0a893a982c..24f81d09f0 100644 --- a/terraform/prod.tfvars +++ b/terraform/prod.tfvars @@ -39,8 +39,9 @@ website_managed_waf_rules = { } } website_feature_flags = { - useNewTable = true, - myProfileEnabled = false + useNewTable = true, + myProfileEnabled = false, + newTerminologyEnabled = false } // ECS Cluster diff --git a/terraform/sandbox.tfvars b/terraform/sandbox.tfvars index 71ca6690f9..1169588f4d 100644 --- a/terraform/sandbox.tfvars +++ b/terraform/sandbox.tfvars @@ -14,8 +14,9 @@ website_enabled = true website_domain_name = "sandbox.grants.usdr.dev" website_managed_waf_rules = {} website_feature_flags = { - useNewTable = true, - myProfileEnabled = true + useNewTable = true, + myProfileEnabled = true, + newTerminologyEnabled = false } // ECS Cluster diff --git a/terraform/staging.tfvars b/terraform/staging.tfvars index 7d65bd4831..95fce1d61a 100644 --- a/terraform/staging.tfvars +++ b/terraform/staging.tfvars @@ -36,8 +36,9 @@ website_managed_waf_rules = { } } website_feature_flags = { - useNewTable = true, - myProfileEnabled = true + useNewTable = true, + myProfileEnabled = true, + newTerminologyEnabled = true } // ECS Cluster