From 7bb6322bf5f377867e0a6a82169c891f3e5799e7 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 22:47:51 +0530 Subject: [PATCH 1/3] Made a change to check Test Status. --- orders/src/routes/__test__/delete.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orders/src/routes/__test__/delete.test.ts b/orders/src/routes/__test__/delete.test.ts index 42acd6e..bbdcf93 100644 --- a/orders/src/routes/__test__/delete.test.ts +++ b/orders/src/routes/__test__/delete.test.ts @@ -12,7 +12,7 @@ const mockOrderId = new mongoose.Types.ObjectId().toHexString(); it("Orders DELETE Route Test: Has a route handler listening to /api/orders/:orderId for DELETE Requests.", async () => { // Make a request to the route and make sure that we are not getting a 404 which indicates the absence of the route const response = await request(app).delete(`/api/orders/${mockOrderId}`); - expect(response.status).not.toEqual(404); + expect(response.status).not.toEqual(400); }); it("Orders DELETE Route Test: /api/orders/:orderId can only be accessed only if the user is Signed-In.", async () => { From e2d822fef9ebcd60483b7deb176bad21b179c911 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 22:51:47 +0530 Subject: [PATCH 2/3] Updated test condition. --- orders/src/routes/__test__/delete.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orders/src/routes/__test__/delete.test.ts b/orders/src/routes/__test__/delete.test.ts index bbdcf93..3b62f69 100644 --- a/orders/src/routes/__test__/delete.test.ts +++ b/orders/src/routes/__test__/delete.test.ts @@ -12,12 +12,12 @@ const mockOrderId = new mongoose.Types.ObjectId().toHexString(); it("Orders DELETE Route Test: Has a route handler listening to /api/orders/:orderId for DELETE Requests.", async () => { // Make a request to the route and make sure that we are not getting a 404 which indicates the absence of the route const response = await request(app).delete(`/api/orders/${mockOrderId}`); - expect(response.status).not.toEqual(400); + expect(response.status).not.toEqual(404); }); it("Orders DELETE Route Test: /api/orders/:orderId can only be accessed only if the user is Signed-In.", async () => { // Make a request to the route without any authentication data and expect a 401 - not authenticated - await request(app).delete(`/api/orders/${mockOrderId}`).expect(401); + await request(app).delete(`/api/orders/${mockOrderId}`).expect(404); }); it("Orders DELETE Route Test: /api/orders/:orderId can be accessed if the user is Signed-In.", async () => { From cf1daac1580be261fd35205374d6e47aefd4abc0 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 22:53:45 +0530 Subject: [PATCH 3/3] Test Performing as Expected - Reverting change. --- orders/src/routes/__test__/delete.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orders/src/routes/__test__/delete.test.ts b/orders/src/routes/__test__/delete.test.ts index 3b62f69..42acd6e 100644 --- a/orders/src/routes/__test__/delete.test.ts +++ b/orders/src/routes/__test__/delete.test.ts @@ -17,7 +17,7 @@ it("Orders DELETE Route Test: Has a route handler listening to /api/orders/:orde it("Orders DELETE Route Test: /api/orders/:orderId can only be accessed only if the user is Signed-In.", async () => { // Make a request to the route without any authentication data and expect a 401 - not authenticated - await request(app).delete(`/api/orders/${mockOrderId}`).expect(404); + await request(app).delete(`/api/orders/${mockOrderId}`).expect(401); }); it("Orders DELETE Route Test: /api/orders/:orderId can be accessed if the user is Signed-In.", async () => {