Skip to content

Commit

Permalink
fix: Update types
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Jan 10, 2024
1 parent 99e84ce commit 3639919
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe("Create payment send events webhook", () => {
it("returns a 400 if a required value is missing", async () => {
await supertest(app)
.post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { somethingElse: "123" } })
.expect(400)
.then((response) =>
Expand All @@ -92,7 +92,7 @@ describe("Create payment send events webhook", () => {

await supertest(app)
.post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "123" } })
.expect(200)
.then((response) => {
Expand All @@ -108,7 +108,7 @@ describe("Create payment send events webhook", () => {

await supertest(app)
.post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand All @@ -131,7 +131,7 @@ describe("Create payment send events webhook", () => {

await supertest(app)
.post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(500)
.then((response) => {
Expand Down
16 changes: 8 additions & 8 deletions api.planx.uk/modules/send/bops/bops.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe(`sending an application to BOPS`, () => {

await supertest(app)
.post("/bops/southwark")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "123" } })
.expect(200)
.then((res) => {
Expand All @@ -115,7 +115,7 @@ describe(`sending an application to BOPS`, () => {
it("throws an error if payload is missing", async () => {
await supertest(app)
.post("/bops/southwark")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: null })
.expect(400)
.then((res) => {
Expand All @@ -126,7 +126,7 @@ describe(`sending an application to BOPS`, () => {
it("throws an error if team is unsupported", async () => {
await supertest(app)
.post("/bops/unsupported-team")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "123" } })
.expect(400)
.then((res) => {
Expand All @@ -150,7 +150,7 @@ describe(`sending an application to BOPS`, () => {

await supertest(app)
.post("/bops/southwark")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "previously_submitted_app" } })
.expect(200)
.then((res) => {
Expand Down Expand Up @@ -226,7 +226,7 @@ describe(`sending an application to BOPS v2`, () => {

await supertest(app)
.post("/bops-v2/southwark")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "123" } })
.expect(200)
.then((res) => {
Expand All @@ -246,7 +246,7 @@ describe(`sending an application to BOPS v2`, () => {
it("throws an error if payload is missing", async () => {
await supertest(app)
.post("/bops-v2/southwark")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: null })
.expect(400)
.then((res) => {
Expand All @@ -257,7 +257,7 @@ describe(`sending an application to BOPS v2`, () => {
it("throws an error if team is unsupported", async () => {
await supertest(app)
.post("/bops-v2/unsupported-team")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "123" } })
.expect(400)
.then((res) => {
Expand All @@ -281,7 +281,7 @@ describe(`sending an application to BOPS v2`, () => {

await supertest(app)
.post("/bops-v2/southwark")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "previously_submitted_app" } })
.expect(200)
.then((res) => {
Expand Down
8 changes: 4 additions & 4 deletions api.planx.uk/modules/send/email/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe(`sending an application by email to a planning office`, () => {
it("succeeds when provided with valid data", async () => {
await supertest(app)
.post("/email-submission/southwark")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "123" } })
.expect(200)
.then((res) => {
Expand All @@ -133,7 +133,7 @@ describe(`sending an application by email to a planning office`, () => {
it("errors if the payload body does not include a sessionId", async () => {
await supertest(app)
.post("/email-submission/southwark")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { somethingElse: "123" } })
.expect(400)
.then((res) => {
Expand All @@ -160,7 +160,7 @@ describe(`sending an application by email to a planning office`, () => {

await supertest(app)
.post("/email-submission/other-council")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "123" } })
.expect(400)
.then((res) => {
Expand All @@ -183,7 +183,7 @@ describe(`sending an application by email to a planning office`, () => {

await supertest(app)
.post("/email-submission/other-council")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { sessionId: "123" } })
.expect(500)
.then((res) => {
Expand Down
2 changes: 1 addition & 1 deletion api.planx.uk/modules/send/uniform/uniform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe(`sending an application to uniform`, () => {
it("errors if the payload body does not include a sessionId", async () => {
await supertest(app)
.post("/uniform/southwark")
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send({ payload: { somethingElse: "123" } })
.expect(400)
.then((res) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("Analyze sessions webhook", () => {
mockOperationHandler.mockRejectedValueOnce("Unhandled error!");

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.expect(500)
.then((response) =>
expect(response.body.error).toMatch(
Expand All @@ -63,7 +63,7 @@ describe("Analyze sessions webhook", () => {
]);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.expect(200)
.then((response) => {
expect(mockOperation1).toHaveBeenCalled();
Expand Down Expand Up @@ -107,7 +107,7 @@ describe("Analyze sessions webhook", () => {
]);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.expect(500)
.then((response) => {
expect(mockOperation1).toHaveBeenCalled();
Expand Down Expand Up @@ -164,7 +164,7 @@ describe("Analyze sessions webhook", () => {
]);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.expect(500)
.then((response) => {
expect(mockOperation1).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe("Create reminder event webhook", () => {

for (const body of invalidRequestBodies) {
await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(400)
.then((response) => {
Expand All @@ -68,7 +68,7 @@ describe("Create reminder event webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand All @@ -89,7 +89,7 @@ describe("Create reminder event webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand Down Expand Up @@ -124,7 +124,7 @@ describe("Create reminder event webhook", () => {
mockedCreateScheduledEvent.mockRejectedValue(new Error("Failed!"));

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(500)
.then((response) => {
Expand Down Expand Up @@ -156,7 +156,7 @@ describe("Create expiry event webhook", () => {

for (const body of [missingCreatedAt, missingPayload]) {
await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(400)
.then((response) => {
Expand All @@ -174,7 +174,7 @@ describe("Create expiry event webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand All @@ -191,7 +191,7 @@ describe("Create expiry event webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand All @@ -211,7 +211,7 @@ describe("Create expiry event webhook", () => {
mockedCreateScheduledEvent.mockRejectedValue(new Error("Failed!"));

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(500)
.then((response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("Create payment invitation events webhook", () => {

for (const body of [missingCreatedAt, missingPayload]) {
await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(400)
.then((response) => {
Expand All @@ -54,7 +54,7 @@ describe("Create payment invitation events webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand All @@ -75,7 +75,7 @@ describe("Create payment invitation events webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand Down Expand Up @@ -113,7 +113,7 @@ describe("Create payment invitation events webhook", () => {
mockedCreateScheduledEvent.mockRejectedValue(new Error("Failed!"));

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(500)
.then((response) => {
Expand Down Expand Up @@ -145,7 +145,7 @@ describe("Create payment reminder events webhook", () => {

for (const body of [missingCreatedAt, missingPayload]) {
await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(400)
.then((response) => {
Expand All @@ -163,7 +163,7 @@ describe("Create payment reminder events webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand All @@ -186,7 +186,7 @@ describe("Create payment reminder events webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand Down Expand Up @@ -244,7 +244,7 @@ describe("Create payment reminder events webhook", () => {
mockedCreateScheduledEvent.mockRejectedValue(new Error("Failed!"));

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(500)
.then((response) => {
Expand Down Expand Up @@ -276,7 +276,7 @@ describe("Create payment expiry events webhook", () => {

for (const body of [missingCreatedAt, missingPayload]) {
await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(400)
.then((response) => {
Expand All @@ -294,7 +294,7 @@ describe("Create payment expiry events webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand All @@ -315,7 +315,7 @@ describe("Create payment expiry events webhook", () => {
mockedCreateScheduledEvent.mockResolvedValue(mockScheduledEventResponse);

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(200)
.then((response) => {
Expand Down Expand Up @@ -353,7 +353,7 @@ describe("Create payment expiry events webhook", () => {
mockedCreateScheduledEvent.mockRejectedValue(new Error("Failed!"));

await post(ENDPOINT)
.set({ Authorization: process.env.HASURA_PLANX_API_KEY })
.set({ Authorization: process.env.HASURA_PLANX_API_KEY! })
.send(body)
.expect(500)
.then((response) => {
Expand Down
Loading

0 comments on commit 3639919

Please sign in to comment.