-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generic/typed userInfo for FusionAuthService
- Loading branch information
Showing
2 changed files
with
13 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,16 +29,21 @@ describe('FusionAuthService', () => { | |
it('Can be configured to automatically handle getting userInfo', (done: DoneFn) => { | ||
mockIsLoggedIn(); | ||
|
||
const user = { email: '[email protected]' }; | ||
const user = { | ||
email: '[email protected]', | ||
customTrait: 'something special', | ||
}; | ||
spyOn(window, 'fetch').and.resolveTo( | ||
new Response(JSON.stringify(user), { status: 200 }), | ||
); | ||
|
||
const service = configureTestingModule(config); | ||
const service: FusionAuthService<typeof user> = | ||
configureTestingModule(config); | ||
|
||
service.getUserInfoObservable().subscribe({ | ||
next: userInfo => { | ||
expect(userInfo.email).toBe('[email protected]'); | ||
expect(userInfo.customTrait).toBe('something special'); | ||
done(); | ||
}, | ||
}); | ||
|
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