initial commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
const request = require("supertest");
|
||||||
|
const app = require("../index");
|
||||||
|
|
||||||
|
describe("Get route", () => {
|
||||||
|
it("page should return hello world", async () => {
|
||||||
|
const res = await request(app).get("/");
|
||||||
|
expect(res.statusCode).toEqual(200);
|
||||||
|
expect(res.body).toEqual("Hello world");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await app.close();
|
||||||
|
});
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
const express = require("express");
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
app.get("/", (req, res) => {
|
||||||
|
res.status(200).json("Hello world");
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = app.listen(process.env.PORT || 4000, () =>
|
||||||
|
console.log(`Running on http://localhost:4000`)
|
||||||
|
);
|
||||||
|
|
||||||
Generated
+3636
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "jenkins-test",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "a node app to learn jenkins",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node index.js",
|
||||||
|
"test": "jest"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitea.thuispc.dynu.net/steven/jenkins-test.git"
|
||||||
|
},
|
||||||
|
"author": "steven",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.17.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jest": "^27.1.0",
|
||||||
|
"supertest": "^6.1.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user