Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- it( 'should return a session with proper request', function(){
- const randomUser = new User({
- name: 'random',
- email: 'random@random.com',
- password: 'password2'
- });
- randomUser.save( (err) => {
- if (err){
- console.log( err.message);
- }
- });
- const token = jwt.sign({
- _id: randomUser._id,
- }, JWT_SECRET, {
- expiresIn: 60 * 60
- });
- console.log( 'token is: ', token );
- console.log( 'random user is: ', randomUser._id) ;
- const practiceRequest = {
- operation: "+",
- number: "10", ///this will possible need to be sent as a number
- min: "1",
- max: "200"
- };
- return chai.request(app)
- .post('/api/session')
- .set('Authorization', 'Bearer ' + token)
- .send( practiceRequest )
- .then( (res) => {
- res.should.have.status(201);
- })
- });
- });
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement