Skip to content

Commit

Permalink
src/auth: Fix test breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
sashko9807 committed Nov 7, 2023
1 parent 6fa38f0 commit c42e7b3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/api/src/auth/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe('AuthService', () => {
birthday: null,
personalNumber: null,
stripeCustomerId: null,
profileEnabled: false,
}

beforeEach(async () => {
Expand Down Expand Up @@ -310,6 +311,9 @@ describe('AuthService', () => {
const password = 's3cret'
const firstName = 'John'
const lastName = 'Doe'
//if no company has been created company.id is expected to be undefined
const companyId = undefined
const profileEnabled = true
const newsletter = true

it('should call keycloak and prisma', async () => {
Expand Down Expand Up @@ -360,7 +364,7 @@ describe('AuthService', () => {

// Check db creation
expect(prismaSpy).toHaveBeenCalledWith({
create: { keycloakId, email, firstName, lastName, newsletter },
create: { keycloakId, email, firstName, lastName, newsletter, companyId, profileEnabled },
update: { keycloakId },
where: { email },
})
Expand Down Expand Up @@ -419,6 +423,7 @@ describe('AuthService', () => {
birthday: null,
personalNumber: null,
stripeCustomerId: null,
profileEnabled: true,
}
jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person)
jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId })
Expand Down Expand Up @@ -468,6 +473,7 @@ describe('AuthService', () => {
birthday: null,
personalNumber: null,
stripeCustomerId: null,
profileEnabled: true,
}
jest.spyOn(prismaMock.person, 'upsert').mockResolvedValue(person)
jest.spyOn(admin.users, 'create').mockResolvedValue({ id: keycloakId })
Expand Down

0 comments on commit c42e7b3

Please sign in to comment.