Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GunnlaugurG committed Oct 11, 2024
1 parent 6fc9b6f commit 2c865f5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ export class DelegationAdminController {
async createByZendeskId(
@Body() { id }: ZendeskWebhookInputDto,
): Promise<void> {
await this.auditService.auditPromise(
await this.auditService.auditPromise<DelegationDTO>(
{
system: true,
namespace,
action: 'createByZendeskId',
resources: (res) => {
return `id: ${res.id}, toNationalId: ${
return `id: ${res.id ?? 'Unknown'}, toNationalId: ${
res.toNationalId ?? 'Unknown'
}, fromNationalId: ${
res.fromNationalId ?? 'Unknown'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import request from 'supertest'
import bodyParser from 'body-parser'

import {
getRequestMethod,
Expand All @@ -12,8 +11,11 @@ import { User } from '@island.is/auth-nest-tools'
import { FixtureFactory } from '@island.is/services/auth/testing'
import { createCurrentUser } from '@island.is/testing/fixtures'
import { DelegationAdminScopes } from '@island.is/auth/scopes'
import { DelegationDTO, SequelizeConfigService } from '@island.is/auth-api-lib'
import { DelegationAdminCustomService } from '@island.is/auth-api-lib'
import {
DelegationAdminCustomService,
DelegationDTO,
SequelizeConfigService,
} from '@island.is/auth-api-lib'

import { AppModule } from '../../../app.module'
import { includeRawBodyMiddleware } from '@island.is/infra-nest-server'
Expand Down Expand Up @@ -159,7 +161,16 @@ describe('withoutAuth and permissions', () => {

jest
.spyOn(delegationAdminService, 'createDelegationByZendeskId')
.mockImplementation(() => Promise.resolve())
.mockImplementation(() =>
Promise.resolve({
id: '123',
fromNationalId: '1234567890',
fromName: 'Test',
toNationalId: '0987654321',
toName: 'Test',
createdByNationalId: '0101010101',
} as DelegationDTO),
)
})

afterEach(() => {
Expand Down

0 comments on commit 2c865f5

Please sign in to comment.