Last active
March 21, 2019 08:22
-
-
Save innocentEdosa/7c89237b1de5761dbd07a16da6faa071 to your computer and use it in GitHub Desktop.
Test showing TDD by INNOCENT ILEGBINIJIE
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
import supertest from 'supertest'; | |
import {should} form 'chai'; | |
import app from './index.js'; | |
const mockUser = { | |
email: 'awonderfuluser@gmail.com', | |
username: 'wonderfuluser', | |
password: 'anotherwonderwonders'} | |
describe('POST /api/users', () => { | |
it('should register a new user', async () => { | |
try { | |
const result = await server | |
.post('/api/users') | |
.send(mockUser); | |
result.status.should.equal(201); | |
result.body.should.be.an('object'); | |
result.body.should.have.property('user'); | |
} | |
catch(err) { | |
throw err | |
} | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have done a good job with your test but you may need to add semicolons on lines 23 and 24.