Skip to content

Commit

Permalink
Create deliverSubpoenaRevokedToPoliceGuards.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
unakb committed Dec 19, 2024
1 parent 0a9cd3f commit 161892f
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { indictmentCases } from '@island.is/judicial-system/types'

import { CaseExistsGuard, CaseTypeGuard } from '../../../case'
import { DefendantExistsGuard } from '../../../defendant'
import { SubpoenaExistsGuard } from '../../guards/subpoenaExists.guard'
import { InternalSubpoenaController } from '../../internalSubpoena.controller'

describe('InternalSubpoenaController - Deliver subpoena revoked to police guards', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let guards: any[]

beforeEach(() => {
guards = Reflect.getMetadata(
'__guards__',
InternalSubpoenaController.prototype.deliverSubpoenaRevokedToPolice,
)
})

it('should have the right guard configuration', () => {
expect(guards).toHaveLength(4)
expect(new guards[0]()).toBeInstanceOf(CaseExistsGuard)
expect(guards[1]).toBeInstanceOf(CaseTypeGuard)
expect(guards[1]).toEqual({
allowedCaseTypes: indictmentCases,
})
expect(new guards[2]()).toBeInstanceOf(DefendantExistsGuard)
expect(new guards[3]()).toBeInstanceOf(SubpoenaExistsGuard)
})
})

0 comments on commit 161892f

Please sign in to comment.