-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Ex UI 1782 rework case role allocation screens to allow allocate to me (#3718) * changes Reserve to me label to Allocate to me * role category filtering removed from the choose-role component * commented unrelated unit tests * comment out unrelated unit tests * yarn audit * proposed fix for functional test failure * yarn audit * Unit tests fix based on PR review * pipeline build failure fixes --------- Co-authored-by: RiteshHMCTS <[email protected]> Co-authored-by: Ritesh Dsouza <[email protected]> * Add fix for caseworker names not appearing in task lists (#3751) * Add fix for caseworker names not appearing in task lists * Updating Terraform Formatting * Update yarn-audit-known-issues * Update yarn-audit-known-issues --------- Co-authored-by: 54687 <61242337+hmcts-jenkins-j-to-z[bot]@users.noreply.github.com> Co-authored-by: RiteshHMCTS <[email protected]> * Bug/e UI 2028 tasks not being unassigned (#3794) * Add the new pre-sign-in caseworker calls * Fix lint issues * Create caseWorkerUserDataCacheService.spec.ts * Fix linting issues * Attempt to fix functional tests * Fix functional tests * Update caseWorkerUserDataCacheService.ts * Update caseWorkerUserDataCacheService.ts --------- Co-authored-by: Andy Wilkins <[email protected]> Co-authored-by: RiteshHMCTS <[email protected]> * common lib version updated * toolkit version updated * toolkit version updated --------- Co-authored-by: OgunyemiO <[email protected]> Co-authored-by: connorpgpmcelroy <[email protected]> Co-authored-by: 54687 <61242337+hmcts-jenkins-j-to-z[bot]@users.noreply.github.com> Co-authored-by: Andy Wilkins <[email protected]>
- Loading branch information
1 parent
dea5d99
commit 80ad0aa
Showing
29 changed files
with
313 additions
and
165 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
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import * as chai from 'chai'; | ||
import { expect } from 'chai'; | ||
import 'mocha'; | ||
import * as sinon from 'sinon'; | ||
import * as sinonChai from 'sinon-chai'; | ||
import { mockRes } from 'sinon-express-mock'; | ||
import { http } from '../lib/http'; | ||
import { fetchNewUserData, fetchRoleAssignmentsForNewUsers } from './caseWorkerUserDataCacheService'; | ||
import { StaffUserDetails } from './interfaces/staffUserDetails'; | ||
|
||
chai.use(sinonChai); | ||
|
||
describe('Caseworker Cache Service', () => { | ||
let sandbox: sinon.SinonSandbox; | ||
|
||
beforeEach(() => { | ||
sandbox = sinon.createSandbox(); | ||
}); | ||
|
||
afterEach(() => { | ||
sandbox.restore(); | ||
}); | ||
|
||
describe('fetchNewUserData', () => { | ||
it('should make a get request', async () => { | ||
const mockStaffDetails = [{}, {}, {}]; | ||
const res = mockRes({ status: 200, data: mockStaffDetails }); | ||
sandbox.stub(http, 'get').resolves(res); | ||
const data = await fetchNewUserData(); | ||
expect(data).to.equal(mockStaffDetails); | ||
}); | ||
}); | ||
|
||
describe('fetchRoleAssignmentsForNewUsers', () => { | ||
it('should make a post request', async () => { | ||
const mockStaffUserDetails: StaffUserDetails[] = [ | ||
{ | ||
ccd_service_name: 'EMPLOYMENT', | ||
staff_profile: { | ||
id: '0bdd43aa-527b-40ac-9d68-d72bd45054f4', | ||
first_name: 'Latest', | ||
last_name: 'New', | ||
region_id: '1', | ||
user_type: 'CTSC', | ||
suspended: 'false', | ||
case_allocator: 'Y', | ||
task_supervisor: 'Y', | ||
staff_admin: 'N', | ||
email_id: '[email protected]', | ||
region: 'London', | ||
base_location: [{ | ||
location_id: '637145', | ||
location: 'Wrexham', | ||
is_primary: true | ||
}], | ||
user_type_id: '1', | ||
role: [], | ||
skills: [], | ||
work_area: [], | ||
idam_roles: '', | ||
created_time: new Date(), | ||
last_updated_time: new Date() | ||
} | ||
}]; | ||
const mockRoleAssignments = [{ | ||
id: '123', | ||
attributes: {}, | ||
roleCategory: 'ADMIN', | ||
actorId: '0bdd43aa-527b-40ac-9d68-d72bd45054f4' | ||
}]; | ||
const finalCaseworkers = [{ | ||
email: '[email protected]', | ||
firstName: 'Latest', | ||
idamId: '0bdd43aa-527b-40ac-9d68-d72bd45054f4', | ||
lastName: 'New', | ||
location: { id: '637145', locationName: 'Wrexham', services: undefined }, | ||
roleCategory: 'ADMIN', | ||
service: 'EMPLOYMENT' | ||
}]; | ||
const res = mockRes({ status: 200, data: { roleAssignmentResponse: mockRoleAssignments } }); | ||
sandbox.stub(http, 'post').resolves(res); | ||
const data = await fetchRoleAssignmentsForNewUsers(mockStaffUserDetails); | ||
expect(data).to.deep.equal(finalCaseworkers); | ||
}); | ||
}); | ||
}); |
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.