generated from Greenstand/treetracker-microservice-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Kpoke/fix/test_max_connections
fix/test max connections
- Loading branch information
Showing
5 changed files
with
30 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require('dotenv').config({ path: `.env.${process.env.NODE_ENV}` }); | ||
const log = require('loglevel'); | ||
require('../server/setup'); | ||
const request = require('supertest'); // eslint-disable-line | ||
const server = require('../server/app'); | ||
|
||
(async () => { | ||
for (let i = 0; i < 1000; i += 1) { | ||
await request(server).get(`/stakeholders`); | ||
log.info(`request ${i + 1}`); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
const request = require('supertest'); | ||
const { expect } = require('chai'); | ||
const server = require("./app"); | ||
const server = require('./app'); | ||
|
||
|
||
describe("", () => { | ||
|
||
it("Test header: content-type: application/json", async () => { | ||
const res = await request(server) | ||
.get('/'); | ||
describe('', () => { | ||
it('Test header: content-type: application/json', async () => { | ||
const res = await request(server).get('/'); | ||
expect(res.statusCode).eq(200); | ||
}); | ||
|
||
it("Test header: content-type: application/json", async () => { | ||
const res = await request(server) | ||
.post('/'); | ||
it('Test header: content-type: application/json', async () => { | ||
const res = await request(server).post('/'); | ||
|
||
expect(res.statusCode).eq(415); | ||
expect(res.body).property("message").match(/application.json/); | ||
expect(res.body) | ||
.property('message') | ||
.match(/application.json/); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* A file to setup some global setting, like log level | ||
*/ | ||
const log = require("loglevel"); | ||
|
||
if(process.env.NODE_LOG_LEVEL){ | ||
const log = require('loglevel'); | ||
|
||
if (process.env.NODE_LOG_LEVEL) { | ||
log.setDefaultLevel(process.env.NODE_LOG_LEVEL); | ||
}else{ | ||
log.setDefaultLevel("info"); | ||
} else { | ||
log.setDefaultLevel('info'); | ||
} | ||
|