Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAAR-1742 Deleted auditService.ts and added it from common npm library #81

Closed
wants to merge 13 commits into from
30 changes: 27 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
"npm": "^9"
},
"jest": {
"transformIgnorePatterns": ["<rootDir>/node_modules/(?!@ministryofjustice/hmpps-audit-client)"],
"transform": {
"^.+\\.(ts|tsx)?$": "ts-jest",
"^.+\\.(js|jsx)$": "babel-jest",
"^.+\\.tsx?$": [
"ts-jest",
{
Expand Down Expand Up @@ -93,6 +96,7 @@
"dependencies": {
"@aws-sdk/client-sqs": "^3.433.0",
"@ministryofjustice/frontend": "^1.8.0",
"@ministryofjustice/hmpps-audit-client": "^1.0.1",
"agentkeepalive": "^4.5.0",
"applicationinsights": "^2.9.0",
"body-parser": "^1.20.2",
Expand Down
9 changes: 1 addition & 8 deletions server/routes/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import type { Express } from 'express'
import request from 'supertest'
import { auditService } from '@ministryofjustice/hmpps-audit-client'
import { appWithAllRoutes } from './testutils/appSetup'
import auditService from '../services/auditService'

let app: Express

const sendAuditMessageMock = jest.fn()

afterEach(() => {
jest.resetAllMocks()
})

describe('index.test.ts', () => {
jest.mock('../services/auditService', () => ({
sendAuditMessage: sendAuditMessageMock,
}))

jest.mock('uuid', () => ({
v1: jest.fn(() => 'mocked-uuid'),
}))
Expand Down
2 changes: 1 addition & 1 deletion server/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type RequestHandler, Router } from 'express'

import { v1 as uuidv1 } from 'uuid'
import { auditService } from '@ministryofjustice/hmpps-audit-client'
import asyncMiddleware from '../middleware/asyncMiddleware'
import type { Services } from '../services'
import auditService from '../services/auditService'

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export default function routes(service: Services): Router {
Expand Down
37 changes: 0 additions & 37 deletions server/services/auditService.test.ts

This file was deleted.

57 changes: 0 additions & 57 deletions server/services/auditService.ts

This file was deleted.