Skip to content

Commit 75c87b9

Browse files
committed
CCM-11026: typecheck fixes
1 parent a8567bf commit 75c87b9

File tree

9 files changed

+14
-12
lines changed

9 files changed

+14
-12
lines changed

lambdas/backend-api/src/__tests__/templates/app/template-client.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { File } from 'node:buffer';
12
import { randomUUID } from 'node:crypto';
23
import { mock } from 'jest-mock-extended';
34
import type {

lambdas/backend-api/src/__tests__/templates/domain/template-pdf.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { TemplatePdf } from '@backend-api/templates/domain/template-pdf';
77
test('has the given key attributes', () => {
88
const pdf = new TemplatePdf(
99
{ id: 'template-id', owner: 'template-owner' },
10-
Buffer.from('')
10+
Uint8Array.from('')
1111
);
1212

1313
expect(pdf.templateId).toBe('template-id');
@@ -20,7 +20,7 @@ test('parse with no custom personalisation', async () => {
2020
);
2121
const pdf = new TemplatePdf(
2222
{ id: 'template-id', owner: 'template-owner' },
23-
file
23+
new Uint8Array(file)
2424
);
2525
await pdf.parse();
2626

@@ -67,7 +67,7 @@ test('parse with custom personalisation', async () => {
6767
);
6868
const pdf = new TemplatePdf(
6969
{ id: 'template-id', owner: 'template-owner' },
70-
file
70+
new Uint8Array(file)
7171
);
7272
await pdf.parse();
7373

lambdas/backend-api/src/__tests__/templates/infra/client-config-repository.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ describe('ClientConfigRepository', () => {
280280
actualError: expect.objectContaining({
281281
issues: expect.arrayContaining([
282282
expect.objectContaining({
283-
message: 'Invalid input: expected object, received undefined',
283+
message: '"undefined" is not valid JSON',
284284
}),
285285
]),
286286
}),
@@ -312,7 +312,7 @@ describe('ClientConfigRepository', () => {
312312
actualError: expect.objectContaining({
313313
issues: expect.arrayContaining([
314314
expect.objectContaining({
315-
message: 'Invalid input: expected object, received undefined',
315+
message: '"undefined" is not valid JSON',
316316
}),
317317
]),
318318
}),

lambdas/backend-api/src/__tests__/templates/infra/letter-upload-repository.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Blob, File } from 'node:buffer';
12
import {
23
GetObjectCommand,
34
GetObjectCommandOutput,

lambdas/backend-api/src/templates/app/get-letter-upload-parts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { File } from 'node:buffer';
12
import { failure, success } from '@backend-api/utils/result';
23
import { ErrorCase, Result } from 'nhs-notify-backend-client';
34
import { LETTER_MULTIPART } from 'nhs-notify-backend-client/src/schemas/constants';

lambdas/backend-api/src/templates/app/template-client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { File } from 'node:buffer';
12
import { randomUUID } from 'node:crypto';
23
import { failure, success, validate } from '@backend-api/utils/index';
34
import {
@@ -22,10 +23,10 @@ import {
2223
} from 'nhs-notify-web-template-management-utils';
2324
import { isRightToLeft } from 'nhs-notify-web-template-management-utils/enum';
2425
import { Logger } from 'nhs-notify-web-template-management-utils/logger';
26+
import { z } from 'zod/v4';
2527
import { LetterUploadRepository } from '../infra/letter-upload-repository';
2628
import { ProofingQueue } from '../infra/proofing-queue';
2729
import { ClientConfigRepository } from '../infra/client-config-repository';
28-
import { z } from 'zod/v4';
2930

3031
export class TemplateClient {
3132
private $LetterForProofing = z.intersection(

lambdas/backend-api/src/templates/domain/template-pdf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class TemplatePdf {
6060
if (!this.parsed) {
6161
const { getDocument } = await import('pdfjs-dist/legacy/build/pdf.mjs');
6262

63-
const loading = getDocument(this.source.buffer);
63+
const loading = getDocument(this.source);
6464

6565
const document = await loading.promise;
6666

lambdas/backend-api/src/templates/infra/letter-upload-repository.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { File } from 'node:buffer';
12
import { z } from 'zod/v4';
23
import { ErrorCase } from 'nhs-notify-backend-client';
34
import type {

scripts/config/pre-commit.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ repos:
1818
- id: pretty-format-json
1919
exclude: |
2020
(?x)^(
21-
package-lock.json
22-
)$
23-
args: ['--autofix']
24-
exclude: |
25-
(?x)^(
21+
package-lock.json|
2622
packages/event-schemas/schemas/[^/]+/[^/]+\.json
2723
)$
24+
args: ['--autofix']
2825
# - id: ...
2926
- repo: local
3027
hooks:

0 commit comments

Comments
 (0)