Skip to content

Commit ceff734

Browse files
fix typeckeck and lint errors
1 parent 1d7367e commit ceff734

2 files changed

Lines changed: 0 additions & 91 deletions

File tree

lambdas/api-handler/src/mappers/__tests__/letter-mapper.test.ts

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -3,104 +3,14 @@ import {
33
mapToGetLetterResponse,
44
mapToGetLettersResponse,
55
mapToPatchLetterResponse,
6-
mapToUpdateCommands,
76
} from "../letter-mapper";
87
import {
98
GetLetterResponse,
109
GetLettersResponse,
1110
PatchLetterResponse,
12-
PostLettersRequest,
1311
} from "../../contracts/letters";
1412

1513
describe("letter-mapper", () => {
16-
it("maps PostLetterRequest to UpdateLetterCommands", () => {
17-
const request: PostLettersRequest = {
18-
data: [
19-
{
20-
id: "id1",
21-
type: "Letter",
22-
attributes: {
23-
status: "REJECTED",
24-
reasonCode: "123",
25-
reasonText: "Reason text",
26-
},
27-
},
28-
{ id: "id2", type: "Letter", attributes: { status: "ACCEPTED" } },
29-
{ id: "id3", type: "Letter", attributes: { status: "DELIVERED" } },
30-
],
31-
};
32-
const supplierId = "testSupplierId";
33-
const updateLetterCommands = mapToUpdateCommands(request, supplierId);
34-
expect(updateLetterCommands).toEqual([
35-
{
36-
id: "id1",
37-
reasonCode: "123",
38-
reasonText: "Reason text",
39-
supplierId: "testSupplierId",
40-
status: "REJECTED",
41-
},
42-
{
43-
id: "id2",
44-
supplierId: "testSupplierId",
45-
status: "ACCEPTED",
46-
},
47-
{
48-
id: "id3",
49-
supplierId: "testSupplierId",
50-
status: "DELIVERED",
51-
},
52-
]);
53-
});
54-
55-
it("maps PostLetterRequest to UpdateLetterCommands and populates statuses map", () => {
56-
const request: PostLettersRequest = {
57-
data: [
58-
{
59-
id: "id1",
60-
type: "Letter",
61-
attributes: {
62-
status: "REJECTED",
63-
reasonCode: "123",
64-
reasonText: "Reason text",
65-
},
66-
},
67-
{ id: "id2", type: "Letter", attributes: { status: "ACCEPTED" } },
68-
{ id: "id3", type: "Letter", attributes: { status: "DELIVERED" } },
69-
],
70-
};
71-
const supplierId = "testSupplierId";
72-
const statusesMap = new Map<string, number>();
73-
const updateLetterCommands = mapToUpdateCommands(
74-
request,
75-
supplierId,
76-
statusesMap,
77-
);
78-
expect(updateLetterCommands).toEqual([
79-
{
80-
id: "id1",
81-
reasonCode: "123",
82-
reasonText: "Reason text",
83-
supplierId: "testSupplierId",
84-
status: "REJECTED",
85-
},
86-
{
87-
id: "id2",
88-
supplierId: "testSupplierId",
89-
status: "ACCEPTED",
90-
},
91-
{
92-
id: "id3",
93-
supplierId: "testSupplierId",
94-
status: "DELIVERED",
95-
},
96-
]);
97-
expect(Object.fromEntries(statusesMap)).toEqual({
98-
REJECTED: 1,
99-
ACCEPTED: 1,
100-
DELIVERED: 1,
101-
});
102-
});
103-
10414
it("maps an internal Letter to a PatchLetterResponse", () => {
10515
const date = new Date().toISOString();
10616
const letter: Letter = {

lambdas/letter-updates-transformer/src/letter-updates-transformer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { MetricsLogger, Unit, metricScope } from "aws-embedded-metrics";
1414
import mapLetterToCloudEvent from "./mappers/letter-mapper";
1515
import { Deps } from "./deps";
1616
import { LetterForEventPub, LetterSchemaForEventPub } from "./types";
17-
import { string } from "zod";
1817

1918
// SNS PublishBatchCommand supports up to 10 messages per batch
2019
const BATCH_SIZE = 10;

0 commit comments

Comments
 (0)