Skip to content

Instantly share code, notes, and snippets.

@innocentEdosa
Last active March 21, 2019 08:22
Show Gist options
  • Save innocentEdosa/7c89237b1de5761dbd07a16da6faa071 to your computer and use it in GitHub Desktop.
Save innocentEdosa/7c89237b1de5761dbd07a16da6faa071 to your computer and use it in GitHub Desktop.
Test showing TDD by INNOCENT ILEGBINIJIE
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
}
});
});
@innocentEdosa
Copy link
Author

Thanks kayroy247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment