-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 3601 - Follow/Notes updates to My Grants (#3633)
* feat: 3601 - my grants with follow notes * feat: update tab specific urls when followNotesEnabled * feat: get followed by grants * feat: add in followed by, fix sorting * feat: get tests passing again * feat: fix CSV export * feat: clean up enhance grant data with feature flag use * feat: consistent use of tables constant
- Loading branch information
Showing
10 changed files
with
247 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,121 @@ | ||
import MyGrantsView from '@/views/MyGrantsView.vue'; | ||
|
||
import { | ||
describe, it, expect, vi, | ||
describe, it, expect, vi, beforeEach, | ||
} from 'vitest'; | ||
import { shallowMount } from '@vue/test-utils'; | ||
import { createStore } from 'vuex'; | ||
import { shareTerminologyEnabled, followNotesEnabled } from '@/helpers/featureFlags'; | ||
import GrantsTable from '@/components/GrantsTable.vue'; | ||
|
||
vi.mock('bootstrap-vue', async () => ({ | ||
// SavedSearchPanel imports bootstrap-vue, which triggers an error in testing, so we'll mock it out | ||
VBToggle: vi.fn(), | ||
})); | ||
|
||
describe('MyGrantsView', () => { | ||
const store = createStore({ | ||
getters: { | ||
'users/selectedAgencyId': () => '123', | ||
}, | ||
}); | ||
const $route = { | ||
params: { | ||
tab: 'applied', | ||
}, | ||
meta: { | ||
tabNames: ['interested', 'applied'], | ||
}, | ||
}; | ||
|
||
it('renders', () => { | ||
const wrapper = shallowMount(MyGrantsView, { | ||
global: { | ||
plugins: [store], | ||
mocks: { | ||
$route, | ||
vi.mock('@/helpers/featureFlags', async (importOriginal) => ({ | ||
...await importOriginal(), | ||
shareTerminologyEnabled: vi.fn(), | ||
followNotesEnabled: vi.fn(), | ||
})); | ||
|
||
describe('MyGrantsView.vue', () => { | ||
describe('when follow notes flag is off', () => { | ||
const store = createStore({ | ||
getters: { | ||
'users/selectedAgencyId': () => '123', | ||
}, | ||
}); | ||
const $route = { | ||
params: { | ||
tab: 'applied', | ||
}, | ||
meta: { | ||
tabNames: ['interested', 'applied'], | ||
}, | ||
}; | ||
|
||
beforeEach(() => { | ||
vi.mocked(shareTerminologyEnabled).mockReturnValue(true); | ||
vi.mocked(followNotesEnabled).mockReturnValue(false); | ||
}); | ||
|
||
it('renders', () => { | ||
const wrapper = shallowMount(MyGrantsView, { | ||
global: { | ||
plugins: [store], | ||
mocks: { | ||
$route, | ||
}, | ||
}, | ||
}); | ||
expect(wrapper.exists()).toBe(true); | ||
|
||
// check tab titles | ||
const html = wrapper.html(); | ||
expect(html).toContain('title="Shared With Your Team"'); | ||
expect(html).toContain('title="Interested"'); | ||
expect(html).toContain('title="Not Applying"'); | ||
expect(html).toContain('title="Applied"'); | ||
expect(html).not.toContain('title="Shared With My Team"'); | ||
expect(html).not.toContain('title="Followed by My Team"'); | ||
|
||
// check tab order and table search title props | ||
const tabs = wrapper.findAllComponents(GrantsTable); | ||
expect(tabs.length).toEqual(4); | ||
expect(tabs[0].props().searchTitle).toEqual('Shared With Your Team'); | ||
expect(tabs[1].props().searchTitle).toEqual('Interested'); | ||
expect(tabs[2].props().searchTitle).toEqual('Not Applying'); | ||
expect(tabs[3].props().searchTitle).toEqual('Applied'); | ||
}); | ||
}); | ||
|
||
describe('when follow notes flag is on', () => { | ||
const store = createStore({ | ||
getters: { | ||
'users/selectedAgencyId': () => '123', | ||
}, | ||
}); | ||
const $route = { | ||
// @todo: adjust these for new tab names? | ||
params: { | ||
tab: 'applied', | ||
}, | ||
meta: { | ||
tabNames: ['interested', 'applied'], | ||
}, | ||
}; | ||
|
||
beforeEach(() => { | ||
vi.mocked(shareTerminologyEnabled).mockReturnValue(true); | ||
vi.mocked(followNotesEnabled).mockReturnValue(true); | ||
}); | ||
|
||
it('renders', () => { | ||
const wrapper = shallowMount(MyGrantsView, { | ||
global: { | ||
plugins: [store], | ||
mocks: { | ||
$route, | ||
}, | ||
}, | ||
}); | ||
expect(wrapper.exists()).toBe(true); | ||
|
||
// check tab titles | ||
const html = wrapper.html(); | ||
expect(html).toContain('title="Shared With My Team"'); | ||
expect(html).toContain('title="Followed by My Team"'); | ||
expect(html).not.toContain('title="Shared With Your Team"'); | ||
expect(html).not.toContain('title="Interested"'); | ||
expect(html).not.toContain('title="Not Applying"'); | ||
expect(html).not.toContain('title="Applied"'); | ||
|
||
// check tab order and table search title props | ||
const tabs = wrapper.findAllComponents(GrantsTable); | ||
expect(tabs.length).toEqual(2); | ||
expect(tabs[0].props().searchTitle).toEqual('Shared With My Team'); | ||
expect(tabs[1].props().searchTitle).toEqual('Followed by My Team'); | ||
}); | ||
expect(wrapper.exists()).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.