Compare commits

...

5 Commits

Author SHA1 Message Date
Gitea
2132babc51 sixth commit
Some checks failed
Node API Test / test (push) Failing after 17s
2026-04-16 15:58:11 +05:30
Gitea
6838b2754c fifth commit
All checks were successful
Node API Test / test (push) Successful in 24s
2026-04-16 15:51:19 +05:30
Gitea
dbda40e864 remove node_modules from tracking
All checks were successful
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
All checks were successful
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 5131 additions and 3 deletions

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: on:
push: push:
@@ -6,9 +22,19 @@ on:
- main - main
jobs: jobs:
build: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - 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
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules/

28
index.js Normal file
View File

@@ -0,0 +1,28 @@
const express = require("express");
const app = express();
app.use(express.json());
app.get("/", (req, res) => {
res.json({
status: "OK",
message: "Home Route Working"
});
});
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
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

22
package.json Normal file
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
test.js Normal file
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");
});
});