Skip to content
Snippets Groups Projects
Commit 62dee16c authored by Sigmund, Dominik's avatar Sigmund, Dominik Committed by Sigmund, Dominik
Browse files

Fix tests

parent 46a6c826
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -109,7 +109,6 @@ describe('Unit Tests', () => { ...@@ -109,7 +109,6 @@ describe('Unit Tests', () => {
done() done()
}) })
}) })
done()
}) })
}) })
describe('Defined Routes', () => { describe('Defined Routes', () => {
...@@ -201,22 +200,17 @@ describe('Integration Tests', () => { ...@@ -201,22 +200,17 @@ describe('Integration Tests', () => {
}) })
}) })
}) })
it('should allow given Methods', (done) => { it('should allow given Methods', async () => {
startUpServer({ startUpServer({
allowedMethods: ['HEAD'] allowedMethods: ['POST']
}) })
superagent const res = await superagent.post('http://127.0.0.1:7777').send({});
.head('http://127.0.0.1:7777')
.then(res => {
expect(res.status).toBe(200) expect(res.status).toBe(200)
superagent try {
.get('http://127.0.0.1:7777') const res2 = await superagent.get('http://127.0.0.1:7777');
.then(res2 => {}) } catch (error) {
.catch((error) => {
expect(error.status).toBe(405) expect(error.status).toBe(405)
done() }
})
})
}) })
}) })
...@@ -365,6 +359,9 @@ function startUpServer(options) { ...@@ -365,6 +359,9 @@ function startUpServer(options) {
app.get('/', function (req, res) { app.get('/', function (req, res) {
res.send('Hello World!') res.send('Hello World!')
}) })
app.post('/', function (req, res) {
res.send('Some post')
})
app.get('/test', function (req, res) { app.get('/test', function (req, res) {
res.send('Hello Test!') res.send('Hello Test!')
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment