From 9f78a3a3a1fe8c3a0d37fe1fae6f1b87b264e206 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 19:10:55 +0530 Subject: [PATCH 01/16] Added Test Script for CI Testing. --- auth/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auth/package.json b/auth/package.json index 604068e..b1cfa63 100644 --- a/auth/package.json +++ b/auth/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "start": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts", - "test": "jest --watchAll --no-cache" + "test": "jest --watchAll --no-cache", + "test:ci": "jest" }, "jest": { "preset": "ts-jest", From 105be2be8ee9abda2f4773094dbe8e8e189fe4f7 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 19:24:04 +0530 Subject: [PATCH 02/16] Added script for CI Testing. --- orders/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/orders/package.json b/orders/package.json index 010e589..0860052 100644 --- a/orders/package.json +++ b/orders/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "start": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts", - "test": "jest --watchAll --no-cache" + "test": "jest --watchAll --no-cache", + "test:ci": "jest" }, "jest": { "preset": "ts-jest", From 263f398a4056bdbda796dfa90ca9a28d5633d241 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 19:28:18 +0530 Subject: [PATCH 03/16] Added script for CI Testing. --- payments/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/payments/package.json b/payments/package.json index 71f5232..05529c6 100644 --- a/payments/package.json +++ b/payments/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "start": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts", - "test": "jest --watchAll --no-cache" + "test": "jest --watchAll --no-cache", + "test:ci": "jest" }, "jest": { "preset": "ts-jest", From ba8b6824d1bf389b9e51541e289024d649802faa Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 19:39:05 +0530 Subject: [PATCH 04/16] Added script for CI Testing. --- tickets/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tickets/package.json b/tickets/package.json index f885d32..0b0a294 100644 --- a/tickets/package.json +++ b/tickets/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "start": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts", - "test": "jest --watchAll --no-cache" + "test": "jest --watchAll --no-cache", + "test:ci": "jest" }, "jest": { "preset": "ts-jest", From c460d4355bf258aacc39513f43e3799529b90aef Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 19:46:06 +0530 Subject: [PATCH 05/16] For Testing Auth CI Test. --- auth/src/routes/__test__/current-user.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/src/routes/__test__/current-user.test.ts b/auth/src/routes/__test__/current-user.test.ts index 0d478bc..474d2a0 100644 --- a/auth/src/routes/__test__/current-user.test.ts +++ b/auth/src/routes/__test__/current-user.test.ts @@ -11,7 +11,7 @@ it("Current-User Route Test: Check for Valid User Data Return - Returns current .get("/api/users/currentuser") .set("Cookie", cookieFromSignUp) .send() - .expect(200); + .expect(400); expect(response.body.currentUser.email).toEqual("tester@test.com"); }); From 0ccaf12dfda5a404018f2d540e5349c20b7748e2 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 19:48:13 +0530 Subject: [PATCH 06/16] Testing Success. --- auth/src/routes/__test__/current-user.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/src/routes/__test__/current-user.test.ts b/auth/src/routes/__test__/current-user.test.ts index 474d2a0..0d478bc 100644 --- a/auth/src/routes/__test__/current-user.test.ts +++ b/auth/src/routes/__test__/current-user.test.ts @@ -11,7 +11,7 @@ it("Current-User Route Test: Check for Valid User Data Return - Returns current .get("/api/users/currentuser") .set("Cookie", cookieFromSignUp) .send() - .expect(400); + .expect(200); expect(response.body.currentUser.email).toEqual("tester@test.com"); }); From 72e7a6144beaeb54166b32181bd0df26ff7ecba6 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 19:52:42 +0530 Subject: [PATCH 07/16] Updated Title. --- .github/workflows/CI - Tests - Auth Service.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI - Tests - Auth Service.yml b/.github/workflows/CI - Tests - Auth Service.yml index c33ab5f..eee7459 100644 --- a/.github/workflows/CI - Tests - Auth Service.yml +++ b/.github/workflows/CI - Tests - Auth Service.yml @@ -1,4 +1,4 @@ -# ========================================= Main Branch ::: CI - Tests - Auth Service ========================================= +# ========================================= CI - Tests - Auth Service ========================================= name: CI - Tests - Auth Service From 1a333358e8d2f7cdf40ac7e50be78aa2bb634040 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 20:03:47 +0530 Subject: [PATCH 08/16] Configured CI Tests Workflow for Orders service. --- .github/workflows/CI - Tests - Orders Service.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/CI - Tests - Orders Service.yml diff --git a/.github/workflows/CI - Tests - Orders Service.yml b/.github/workflows/CI - Tests - Orders Service.yml new file mode 100644 index 0000000..3eec155 --- /dev/null +++ b/.github/workflows/CI - Tests - Orders Service.yml @@ -0,0 +1,13 @@ +# ========================================= CI - Tests - Orders Service ========================================= + +name: CI - Tests - Orders Service + +on: pull_request + +jobs: + Orders-Service-Pre-Integration-Tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - run: cd orders && npm install && npm run test:ci From ac886f3b6dc31ea1fac1fc67e242385e67dc36ca Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 20:04:31 +0530 Subject: [PATCH 09/16] Modified Job name. --- .github/workflows/CI - Tests - Auth Service.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI - Tests - Auth Service.yml b/.github/workflows/CI - Tests - Auth Service.yml index eee7459..247f03d 100644 --- a/.github/workflows/CI - Tests - Auth Service.yml +++ b/.github/workflows/CI - Tests - Auth Service.yml @@ -5,7 +5,7 @@ name: CI - Tests - Auth Service on: pull_request jobs: - Production-Branch-Pre-Integration-Tests: + Auth-Service-Pre-Integration-Tests: runs-on: ubuntu-latest steps: From 30ea83861cc9214a086cb3cf5216ae3fdde5c1e9 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 20:06:29 +0530 Subject: [PATCH 10/16] Configured CI Tests Workflow for Payments service. --- .../workflows/CI - Tests - Orders Service copy.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/CI - Tests - Orders Service copy.yml diff --git a/.github/workflows/CI - Tests - Orders Service copy.yml b/.github/workflows/CI - Tests - Orders Service copy.yml new file mode 100644 index 0000000..dc07237 --- /dev/null +++ b/.github/workflows/CI - Tests - Orders Service copy.yml @@ -0,0 +1,13 @@ +# ========================================= CI - Tests - Payments Service ========================================= + +name: CI - Tests - Payments Service + +on: pull_request + +jobs: + Payments-Service-Pre-Integration-Tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - run: cd payments && npm install && npm run test:ci From 321c3418c22f5098050d1420010a6681888403bf Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 20:07:05 +0530 Subject: [PATCH 11/16] File name fixed. --- ... Orders Service copy.yml => CI - Tests - Payments Service.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{CI - Tests - Orders Service copy.yml => CI - Tests - Payments Service.yml} (100%) diff --git a/.github/workflows/CI - Tests - Orders Service copy.yml b/.github/workflows/CI - Tests - Payments Service.yml similarity index 100% rename from .github/workflows/CI - Tests - Orders Service copy.yml rename to .github/workflows/CI - Tests - Payments Service.yml From fb1a83f446ae967193153eead2f0073df564e508 Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 20:08:42 +0530 Subject: [PATCH 12/16] Configured CI Tests Workflow for Tickets Service. --- .github/workflows/CI - Tests - Tickets Service.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/CI - Tests - Tickets Service.yml diff --git a/.github/workflows/CI - Tests - Tickets Service.yml b/.github/workflows/CI - Tests - Tickets Service.yml new file mode 100644 index 0000000..ccb2f83 --- /dev/null +++ b/.github/workflows/CI - Tests - Tickets Service.yml @@ -0,0 +1,13 @@ +# ========================================= CI - Tests - Tickets Service ========================================= + +name: CI - Tests - Tickets Service + +on: pull_request + +jobs: + Tickets-Service-Pre-Integration-Tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - run: cd tickets && npm install && npm run test:ci From 8d3233380c7eefe10f3b989eb2acf7cb50aff75b Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 22:43:30 +0530 Subject: [PATCH 13/16] Added configuration to run tests path specific. --- .github/workflows/CI - Tests - Auth Service.yml | 5 ++++- .github/workflows/CI - Tests - Orders Service.yml | 5 ++++- .github/workflows/CI - Tests - Payments Service.yml | 5 ++++- .github/workflows/CI - Tests - Tickets Service.yml | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI - Tests - Auth Service.yml b/.github/workflows/CI - Tests - Auth Service.yml index 247f03d..b51eb10 100644 --- a/.github/workflows/CI - Tests - Auth Service.yml +++ b/.github/workflows/CI - Tests - Auth Service.yml @@ -2,7 +2,10 @@ name: CI - Tests - Auth Service -on: pull_request +on: + pull_request: + paths: + - "auth/**" jobs: Auth-Service-Pre-Integration-Tests: diff --git a/.github/workflows/CI - Tests - Orders Service.yml b/.github/workflows/CI - Tests - Orders Service.yml index 3eec155..a36e407 100644 --- a/.github/workflows/CI - Tests - Orders Service.yml +++ b/.github/workflows/CI - Tests - Orders Service.yml @@ -2,7 +2,10 @@ name: CI - Tests - Orders Service -on: pull_request +on: + pull_request: + paths: + - "orders/**" jobs: Orders-Service-Pre-Integration-Tests: diff --git a/.github/workflows/CI - Tests - Payments Service.yml b/.github/workflows/CI - Tests - Payments Service.yml index dc07237..258438a 100644 --- a/.github/workflows/CI - Tests - Payments Service.yml +++ b/.github/workflows/CI - Tests - Payments Service.yml @@ -2,7 +2,10 @@ name: CI - Tests - Payments Service -on: pull_request +on: + pull_request: + paths: + - "payments/**" jobs: Payments-Service-Pre-Integration-Tests: diff --git a/.github/workflows/CI - Tests - Tickets Service.yml b/.github/workflows/CI - Tests - Tickets Service.yml index ccb2f83..2d8fb29 100644 --- a/.github/workflows/CI - Tests - Tickets Service.yml +++ b/.github/workflows/CI - Tests - Tickets Service.yml @@ -2,7 +2,10 @@ name: CI - Tests - Tickets Service -on: pull_request +on: + pull_request: + paths: + - "tickets/**" jobs: Tickets-Service-Pre-Integration-Tests: 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 14/16] 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 15/16] 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 16/16] 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 () => {