Skip to content

Instantly share code, notes, and snippets.

@Inclet
Created March 13, 2019 11:12
Show Gist options
  • Save Inclet/48f9f18726965403c6b0cd01335bb524 to your computer and use it in GitHub Desktop.
Save Inclet/48f9f18726965403c6b0cd01335bb524 to your computer and use it in GitHub Desktop.
import chai from "chai";
import chaiHttp from "chai-http";
import app from "../index"; //entry point.
chai.should();
chai.use(chaiHttp);
let token;
describe('Signing up a user' , ()=>{
const user = {
firstName: "Yvan",
middleName: "",
lastName: "Cyuzuzo",
email: "yvancyuz@gmail.com",
username: "Yvano",
password: "Google23!"
}
it("/api/v1/auth/signup --Signing up an new user", (done){
chai.request(app)
.post('/api/v1/auth/signup')
.send(user)
.end((res)=>{
token = res.body.data[0].token;
res.body.should.be.a('object');
res.body.should.have.property('status').eql(201);
res.body.data[0].should.have.property('token');
res.body.data[0].should.have.property('username').eql('Yvano');
res.body.data[0].should.have.property('email').eql('yvancyuz@gmail.com');
res.body.data[0].should.have.propert('firstName').eql('Clet');
res.body.data[0].should.have.property('otherName').eql('');
res.should.data[0].should.have.property('lastName').eql('Cyuzuzo');
done();
})
})
})
@mystere10
Copy link

mystere10 commented Mar 13, 2019

Congs for the code but:

  1. Use eslint to align your code to the standard conventions

@frankhn
Copy link

frankhn commented Mar 13, 2019

-Eslint boy.

@mwibutsa
Copy link

  • be consistent (if you prefer adding semicolons at the end of statement do it for all statements)
  • Consider using Eslint

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