user /projects/challenge $ cd "/projects/challenge" && npm test > sales_expenses@1.0.0 test > jest --forceExit FAIL test/app.test.js ✓ Getting all the data (57 ms) ✓ Getting total expense (6 ms) ✓ Getting add expense (21 ms) ✕ Getting else part expense (11 ms) ✕ Getting savings amount (7 ms) ✕ Getting delete expense (7 ms) ● Getting else part expense expect(received).toBe(expected) // Object.is equality Expected: "{\"message\":\"Given amount is greater than savings amounts.\"}" Received: "{\"message\":\"Given amount is greater\"}" 117 | }) 118 | .expect(200); > 119 | expect(JSON.stringify(response.body)).toBe( | ^ 120 | JSON.stringify({ message: "Given amount is greater than savings amounts." }) 121 | ); 122 | }); at Object. (test/app.test.js:119:41) ● Getting savings amount expect(received).toBe(expected) // Object.is equality Expected: "{\"id\":\"1\",\"name\":\"User1\",\"salary\":\"20000\",\"expense\":[{\"id\":1,\"name\":\"rent\",\"amount\":10000},{\"id\":2,\"name\":\"miscellaneous\",\"amount\":1000},{\"id\":3,\"name\":\"interest\",\"amount\":2000},{\"id\":4,\"name\":\"groceries\",\"amount\":4000}],\"saving\":3000}" Received: "{\"id\":\"1\",\"name\":\"User1\",\"salary\":\"20000\",\"expense\":[{\"id\":1,\"name\":\"rent\",\"amount\":10000},{\"id\":2,\"name\":\"miscellaneous\",\"amount\":1000},{\"id\":3,\"name\":\"interest\",\"amount\":2000},{\"id\":4,\"name\":\"groceries\",\"amount\":4000},{\"id\":5,\"name\":\"repair\",\"amount\":1000}],\"saving\":2000}" 125 | test("Getting savings amount", async () => { 126 | const response = await request(app).patch("/savings").expect(200); > 127 | expect(JSON.stringify(response.body)).toBe( | ^ 128 | JSON.stringify({ 129 | id: "1", 130 | name: "User1", at Object. (test/app.test.js:127:41) ● Getting delete expense expected 200 "OK", got 404 "Not Found" 159 | //checking the delete expense route 160 | test("Getting delete expense", async () => { > 161 | const response = await request(app).delete("/deleteExpense/3").expect(200); | ^ 162 | expect(JSON.stringify(response.body)).toBe( 163 | JSON.stringify({ 164 | id: "1", at Object. (test/app.test.js:161:66) ---- at Test._assertStatus (node_modules/supertest/lib/test.js:252:14) at node_modules/supertest/lib/test.js:308:13 at Test._assertFunction (node_modules/supertest/lib/test.js:285:13) at Test.assert (node_modules/supertest/lib/test.js:164:23) at Server.localAssert (node_modules/supertest/lib/test.js:120:14) Test Suites: 1 failed, 1 total Tests: 3 failed, 3 passed, 6 total Snapshots: 0 total Time: 1 s Ran all test suites. Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?