Skip to content
Permalink
Browse files
cofiguration of testing suite
  • Loading branch information
skondram committed Nov 27, 2021
1 parent af1c006 commit 216332d86b0c32d2566af30a77e185f48f40e191
Show file tree
Hide file tree
Showing 5 changed files with 11,185 additions and 2,584 deletions.
@@ -0,0 +1,14 @@
// check that the npm environment has set the test DB correctly
test('Jest should use the test DB', ()=> {
expect(process.env.DB_DATABASE).toBe('test_db');
})

// This test fails because 1 !== 2
xit('Testing to see if Jest works', () => {
expect(1).toBe(2)
})

// This passes because 1 === 1
xit('Testing to see if Jest works 2', () => {
expect(1).toBe(1)
})
@@ -0,0 +1,16 @@
const request = require('supertest')
const app = require('../app')

describe('Post new user', () => {
it('should create a new user', async () => {
const res = await request(app.callback())
.post('/api/v1/users')
.send({
username: 'unique_11223',
password: 'password',
email: 'unique2_email@example.com'
})
expect(res.statusCode).toEqual(201)
expect(res.body).toHaveProperty('created', true)
})
});
2 app.js
@@ -22,4 +22,4 @@ app.use(applications.routes());

let port = process.env.PORT || 3000;

app.listen(port);
module.exports = app;

0 comments on commit 216332d

Please sign in to comment.