Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,42 @@
],
"license": "MIT",
"dependencies": {
"axios": "^1.6.0",
"axios": "^1.6.2",
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"express": "^4.18.2",
"express-basic-auth": "^1.2.1",
"express-rate-limit": "^7.1.3",
"express-rate-limit": "^7.1.4",
"express-validator": "^7.0.1",
"graphql": "^16.8.1",
"graphql-http": "^1.22.0",
"graphql-tag": "^2.12.6",
"helmet": "^7.0.0",
"helmet": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"moment": "^2.29.4",
"mongodb": "^6.2.0",
"mongoose": "^8.0.0",
"pino": "^8.16.1",
"mongodb": "^6.3.0",
"mongoose": "^8.0.1",
"pino": "^8.16.2",
"pino-pretty": "^10.2.3",
"swagger-ui-express": "^5.0.0",
"switcher-client": "^3.2.0",
"validator": "^13.11.0"
},
"devDependencies": {
"@babel/cli": "^7.23.0",
"@babel/core": "^7.23.2",
"@babel/core": "^7.23.3",
"@babel/node": "^7.22.19",
"@babel/preset-env": "^7.23.2",
"@babel/preset-env": "^7.23.3",
"@babel/register": "^7.22.15",
"babel-jest": "^29.7.0",
"babel-polyfill": "^6.26.0",
"env-cmd": "^10.1.0",
"eslint": "^8.52.0",
"eslint": "^8.54.0",
"jest": "^29.7.0",
"jest-sonar-reporter": "^2.0.0",
"node-notifier": "^10.0.1",
"nodemon": "^3.0.1",
"sinon": "^17.0.0",
"sinon": "^17.0.1",
"supertest": "^6.3.3"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sonar.javascript.lcov.reportPaths=coverage/lcov.info

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=src
sonar.exclusions=src/api-docs/**, src/app-server.js, src/helpers/timed-match/match-proc.js
sonar.exclusions=src/start.js, src/index.js, src/api-docs/**, src/app-server.js, src/helpers/timed-match/match-proc.js
sonar.tests=tests
sonar.language=js

Expand Down
38 changes: 38 additions & 0 deletions tests/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import mongoose from 'mongoose';
import app from '../src/app';
import request from 'supertest';

afterAll(async () => {
await new Promise(resolve => setTimeout(resolve, 1000));
await mongoose.disconnect();
});

describe('Testing app [REST] ', () => {
test('APP_SUITE - Should return success on a health check request', async () => {
const req = await request(app)
.get('/check')
.expect(200);

expect(req.statusCode).toBe(200);
expect(req.body.status).toEqual('UP');
});

test('APP_SUITE - Should return success on a health check request with details', async () => {
const req = await request(app)
.get('/check?details=1')
.expect(200);

expect(req.statusCode).toBe(200);
expect(req.body.status).toEqual('UP');
expect(req.body.attributes).toBeDefined();
});

test('APP_SUITE - Should return 404 - Operation not found', async () => {
const req = await request(app)
.get('/not-found')
.expect(404);

expect(req.statusCode).toBe(404);
expect(req.body.error).toEqual('Operation not found');
});
});