Compare commits

...

7 Commits

Author SHA1 Message Date
Gitea e39dfe6f2b commit
Node API Test / test (push) Successful in 20s
2026-04-20 10:14:02 +05:30
Gitea 79008d0c7c seventh commit
Node API Test / test (push) Successful in 25s
2026-04-20 09:53:53 +05:30
Gitea 2132babc51 sixth commit
Node API Test / test (push) Failing after 17s
2026-04-16 15:58:11 +05:30
Gitea 6838b2754c fifth commit
Node API Test / test (push) Successful in 24s
2026-04-16 15:51:19 +05:30
Gitea dbda40e864 remove node_modules from tracking
Node CI Test / test (push) Successful in 13s
2026-04-16 15:34:14 +05:30
Gitea 2bc20ca994 Merge branch 'main' of https://git.parinaam.in/bunty/node-code
Node CI Test / test (push) Successful in 3m42s
2026-04-16 15:15:23 +05:30
Gitea aa335f76bf fourth commit 2026-04-16 15:14:47 +05:30
6 changed files with 5132 additions and 3 deletions
+29 -3
View File
@@ -1,4 +1,20 @@
name: CI
# name: CI
# on:
# push:
# branches:
# - main
# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - run: echo "Hello from Gitea Actions"
name: Node API Test
on:
push:
@@ -6,9 +22,19 @@ on:
- main
jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Hello from Gitea Actions"
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
+1
View File
@@ -0,0 +1 @@
node_modules/
+29
View File
@@ -0,0 +1,29 @@
const express = require("express");
const app = express();
app.use(express.json());
app.get("/", (req, res) => {
res.json({
status: "OK",
message: "Home Route"
});
});
app.get("/health", (req, res) => {
res.json({
status: "OK",
message: "Server is healthy"
});
});
module.exports = app;
// only start server if not testing
// It ensures the server starts only when the file is run directly, not when it is imported for testing.
if (require.main === module) {
app.listen(3000, () => {
console.log("Server running on port 3000");
});
}
+5025
View File
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
{
"name": "test-parinaam",
"version": "1.0.0",
"description": "do somethig",
"repository": {
"type": "git",
"url": "https://git.parinaam.in/bunty/node-code.git"
},
"license": "ISC",
"author": "",
"type": "commonjs",
"main": "test.js",
"scripts": {
"test": "jest",
"start": "node index.js"
},
"dependencies": {
"express": "^5.2.1",
"jest": "^30.3.0",
"supertest": "^7.2.2"
}
}
+26
View File
@@ -0,0 +1,26 @@
// console.log("Running CI test...");
// if (1 + 1 === 2) {
// console.log("✅ TEST PASSED");
// process.exit(0);
// } else {
// console.log("❌ TEST FAILED");
// process.exit(1);
// }
const request = require("supertest");
const app = require("./index");
describe("API Testing", () => {
test("GET / should return status ok", async () => {
const res = await request(app).get("/");
expect(res.body.status).toBe("OK");
});
test("GET /health should return status OK", async () => {
const res = await request(app).get("/health");
expect(res.body.status).toBe("OK");
});
});