add test-cicd code
This commit is contained in:
19
code/sample-nodejs-app/test/app.test.js
Normal file
19
code/sample-nodejs-app/test/app.test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const request = require('supertest');
|
||||
const app = require('../index');
|
||||
|
||||
describe('GET /', () => {
|
||||
it('should return 200 OK and a welcome message', async () => {
|
||||
const res = await request(app).get('/');
|
||||
expect(res.statusCode).toEqual(200);
|
||||
expect(res.body).toHaveProperty('message');
|
||||
expect(res.body.message).toContain('Hello World');
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /health', () => {
|
||||
it('should return 200 OK', async () => {
|
||||
const res = await request(app).get('/health');
|
||||
expect(res.statusCode).toEqual(200);
|
||||
expect(res.text).toEqual('OK');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user