Skip to content

Commit

Permalink
fix(auth): return erroneously removed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BlairCurrey committed Dec 3, 2024
1 parent 28616c3 commit 4b6ce80
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion packages/auth/src/tenant/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ describe('Tenant Service', (): void => {
})
expect(tenant.deletedAt).toBe(undefined)
})

test('fails to create tenant with duplicate id', async (): Promise<void> => {
const tenantData = createTenantData()
await tenantService.create(tenantData)

await expect(tenantService.create(tenantData)).rejects.toThrow()
})
})

describe('get', (): void => {
Expand Down Expand Up @@ -89,6 +96,22 @@ describe('Tenant Service', (): void => {
})
})

test('can update partial fields', async (): Promise<void> => {
const tenantData = createTenantData()
const created = await tenantService.create(tenantData)

const updateData = {
idpConsentUrl: faker.internet.url()
}

const updated = await tenantService.update(created.id, updateData)
expect(updated).toMatchObject({
id: created.id,
idpConsentUrl: updateData.idpConsentUrl,
idpSecret: created.idpSecret
})
})

test('returns undefined for non-existent tenant', async (): Promise<void> => {
const updated = await tenantService.update(faker.string.uuid(), {
idpConsentUrl: faker.internet.url()
Expand Down Expand Up @@ -122,7 +145,6 @@ describe('Tenant Service', (): void => {
const deletedTenant = await Tenant.query()
.findById(created.id)
.whereNotNull('deletedAt')
console.log({ deletedTenant })
expect(deletedTenant).toBeDefined()
expect(deletedTenant?.deletedAt).toBeDefined()
})
Expand Down

0 comments on commit 4b6ce80

Please sign in to comment.