forked from bcgov/common-hosted-form-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FORMS-1707: decouple forms from current user, optimize performance (b…
…cgov#1579) Get Current User always returns form data even when not used. Make the fetch of user form data explicit by adding new API to fetch the current user forms. Signed-off-by: Jason Sherman <[email protected]>
- Loading branch information
1 parent
2dcf1ae
commit e6204e2
Showing
12 changed files
with
246 additions
and
36 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 |
---|---|---|
|
@@ -11,6 +11,7 @@ import Developer from '~/components/admin/Developer.vue'; | |
describe('Developer.vue', () => { | ||
const mockConsoleError = vi.spyOn(console, 'error'); | ||
const getCurrentUserSpy = vi.spyOn(rbacService, 'getCurrentUser'); | ||
const getCurrentUserFormsSpy = vi.spyOn(rbacService, 'getCurrentUserForms'); | ||
|
||
const pinia = createTestingPinia(); | ||
setActivePinia(pinia); | ||
|
@@ -28,7 +29,12 @@ describe('Developer.vue', () => { | |
}); | ||
|
||
it('renders without error', async () => { | ||
const data = {}; | ||
const userData = { id: 'a' }; | ||
const formsData = []; | ||
const resData = { | ||
...userData, | ||
forms: formsData, | ||
}; | ||
authStore.keycloak = { | ||
tokenParsed: { | ||
email: '[email protected]', | ||
|
@@ -38,7 +44,8 @@ describe('Developer.vue', () => { | |
token: 'token', | ||
fullName: 'fullName', | ||
}; | ||
getCurrentUserSpy.mockImplementation(() => ({ data: data })); | ||
getCurrentUserSpy.mockImplementation(() => ({ data: userData })); | ||
getCurrentUserFormsSpy.mockImplementation(() => ({ data: formsData })); | ||
const wrapper = mount(Developer, { | ||
global: { | ||
props: { | ||
|
@@ -56,7 +63,7 @@ describe('Developer.vue', () => { | |
|
||
expect(wrapper.text()).toMatch('Developer Resources'); | ||
expect(getCurrentUserSpy).toHaveBeenCalledTimes(1); | ||
expect(wrapper.vm.apiRes).toEqual(data); | ||
expect(wrapper.vm.apiRes).toEqual(resData); | ||
}); | ||
|
||
it('renders with error', async () => { | ||
|
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
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.