Skip to content
Permalink
Browse files
Added some more testing on user and app routes
  • Loading branch information
skondram committed Nov 28, 2021
1 parent d7033ef commit f6341cf5cd4006359081931cdca4c1195c3df62c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
@@ -0,0 +1,33 @@
const request = require('supertest')
const app = require('../app')

describe('Post new application', () => {
it('should create a new application', async () => {
const res = await request(app.callback())
.post('/api/v1/applications/all')
.send({
firstName: 'random_11223',
lastName: 'guy_1222',
email: 'random@example.com',
address: '32 Mane Road'
})
expect(res.statusCode).toEqual(201)
expect(res.body).toHaveProperty('created', true)
})
});

describe('Get all applications', () => {
it('should show all applications', async () => {
const res = await request(app.callback())
.get('/api/v1/applications/all')
expect(res.statusCode).toEqual(200)
})
});

describe('Get all users', () => {
it('should show all users', async () => {
const res = await request(app.callback())
.get('/api/v1/users')
expect(res.statusCode).toEqual(401)
})
});
@@ -3,12 +3,3 @@ 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)
})
@@ -20,6 +20,14 @@ describe('Get all users', () => {
it('should show all users', async () => {
const res = await request(app.callback())
.get('/api/v1/users')
expect(res.statusCode).toEqual(401)
})
});

describe('Get all applications', () => {
it('should show all applications', async () => {
const res = await request(app.callback())
.get('/api/v1/applications/all')
expect(res.statusCode).toEqual(200)
})
});

0 comments on commit f6341cf

Please sign in to comment.