-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add readCookieService and language information to client context (#1780)
* Add readCookieService and language information to client context * Add version * Add additional language setting on clientcontext Event guard also sets it * Make sonar advised change * Add sonar suggested change * Update npmpublish.yml * Add change to make client context always appear with language * version updated * release notes updated * version updated * version updated --------- Co-authored-by: Ritesh Dsouza <[email protected]>
- Loading branch information
1 parent
c86360f
commit e73c77b
Showing
17 changed files
with
117 additions
and
65 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
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 |
---|---|---|
|
@@ -3,14 +3,15 @@ import { ActivatedRoute, Router } from '@angular/router'; | |
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { StateMachine } from '@edium/fsm'; | ||
import { Task } from '../../../domain/work-allocation/Task'; | ||
import { SessionStorageService } from '../../../services'; | ||
import { ReadCookieService, SessionStorageService } from '../../../services'; | ||
import { EventStartStateMachineContext, EventStartStates } from '../models'; | ||
import { EventStartStateMachineService } from './event-start-state-machine.service'; | ||
import createSpyObj = jasmine.createSpyObj; | ||
|
||
describe('EventStartStateMachineService', () => { | ||
let service: EventStartStateMachineService; | ||
let stateMachine: StateMachine; | ||
let mockReadCookieService: any; | ||
let mockSessionStorageService: any; | ||
// tslint:disable-next-line: prefer-const | ||
let mockRoute: ActivatedRoute; | ||
|
@@ -109,6 +110,7 @@ describe('EventStartStateMachineService', () => { | |
]; | ||
|
||
mockSessionStorageService = createSpyObj<SessionStorageService>('sessionStorageService', ['getItem', 'setItem']); | ||
mockReadCookieService = createSpyObj<ReadCookieService>('readCookieService', ['getCookie']); | ||
mockSessionStorageService.getItem.and.returnValue(`{"id": "test-user-id", "forename": "Test", "surname": "User", | ||
"roles": ["caseworker-role1", "caseworker-role3"], "email": "[email protected]", "token": null}`); | ||
|
||
|
@@ -119,7 +121,8 @@ describe('EventStartStateMachineService', () => { | |
taskId: '1122-3344-5566-7788', | ||
router: mockRouter, | ||
route: mockRoute, | ||
sessionStorageService: mockSessionStorageService | ||
sessionStorageService: mockSessionStorageService, | ||
cookieService: mockReadCookieService | ||
}; | ||
|
||
beforeEach(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
1 change: 1 addition & 0 deletions
1
projects/ccd-case-ui-toolkit/src/lib/shared/services/cookie/index.ts
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 @@ | ||
export * from './read-cookie-service'; |
21 changes: 21 additions & 0 deletions
21
projects/ccd-case-ui-toolkit/src/lib/shared/services/cookie/read-cookie-service.spec.ts
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,21 @@ | ||
import { ReadCookieService } from "./read-cookie-service"; | ||
|
||
describe('CookieService', () => { | ||
const mockDocument: any = { | ||
cookie: '' | ||
}; | ||
|
||
const cookieService: ReadCookieService = new ReadCookieService(mockDocument); | ||
|
||
afterEach(() => { | ||
mockDocument.cookie = ''; | ||
}); | ||
|
||
it('should get a cookie', () => { | ||
|
||
mockDocument.cookie = 'user=dummy'; | ||
const result = cookieService.getCookie('user'); | ||
expect(result).toBe('dummy'); | ||
}); | ||
|
||
}); |
Oops, something went wrong.