-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10553: Add tests around UserFactory;
- Loading branch information
John Cruz
committed
Dec 13, 2024
1 parent
1c0ea91
commit d49af18
Showing
2 changed files
with
45 additions
and
8 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
shared/src/business/entities/factories/UserFactory.test.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,36 @@ | ||
import { Practitioner } from '@shared/business/entities/Practitioner'; | ||
import { ROLES } from '@shared/business/entities/EntityConstants'; | ||
import { User } from '@shared/business/entities/User'; | ||
import { UserFactory } from '@shared/business/entities/factories/UserFactory'; | ||
|
||
describe('UserFactory', () => { | ||
describe('getClass', () => { | ||
it('should return "Practitioner" class type if role is "privatePractitioner"', () => { | ||
const TEST_USER = { role: ROLES.privatePractitioner }; | ||
const userFactory = new UserFactory(TEST_USER); | ||
const classInstance = userFactory.getClass(); | ||
expect(classInstance).toEqual(Practitioner); | ||
}); | ||
|
||
it('should return "Practitioner" class type if role is "irsPractitioner"', () => { | ||
const TEST_USER = { role: ROLES.irsPractitioner }; | ||
const userFactory = new UserFactory(TEST_USER); | ||
const classInstance = userFactory.getClass(); | ||
expect(classInstance).toEqual(Practitioner); | ||
}); | ||
|
||
it('should return "Practitioner" class type if role is "inactivePractitioner"', () => { | ||
const TEST_USER = { role: ROLES.inactivePractitioner }; | ||
const userFactory = new UserFactory(TEST_USER); | ||
const classInstance = userFactory.getClass(); | ||
expect(classInstance).toEqual(Practitioner); | ||
}); | ||
|
||
it('should return "Practitioner" class type if role is "inactivePractitioner"', () => { | ||
const TEST_USER = { role: ROLES.admin }; | ||
const userFactory = new UserFactory(TEST_USER); | ||
const classInstance = userFactory.getClass(); | ||
expect(classInstance).toEqual(User); | ||
}); | ||
}); | ||
}); |
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