<commit_before>'use strict';

require('../../../server');

var should = require('should');
var request = require('supertest');

var bodyParser = require('body-parser');
var express = require('express');
var app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
request = request('http://localhost:9001');



describe('/api/v1/users', function () {
  var userId;

  it('should save a new user', function (done) {
    request.post('/api/v1/users')
    .send({firstName: 'super', lastName: 'test'})
    .expect(201, function (err, res) {
      if (err){ return done(err); }
      userId = res.body._id;
      should(res.body).have.property('_id');
      done();
    });
  });


  it('should get list of users', function (done) {
    request.get('/api/v1/users')
    .expect(200, function (err, res) {
      if (err){ return done(err); }
      should(res.body).be.ok();
      done();
    });
  });


  it('should get a specific user', function (done) {
    request.get('/api/v1/users/' + userId)
    .expect(200, function (err, res) {
      if (err){ return done(err); }
      should(res.body).have.property('_id');
      done();
    });
  });


  it('should update a specific user', function (done) {
    request.put('/api/v1/users/' + userId)
    .send({firstName: 'supertest', lastName: 'updated'})
    .expect(200, function (err) {
      if (err){ return done(err); }
      done();
    });
  });


  it('should update a specific user', function (done) {
    request.delete('/api/v1/users/' + userId)
    .expect(204, function (err) {
      if (err){ return done(err); }
      done();
    });
  });
});<commit_msg>Fix unit tests<commit_after>'use strict';

require('../../../server');

var should = require('should');
var request = require('supertest');

var bodyParser = require('body-parser');
var express = require('express');
var app = express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
request = request('http://localhost:9001');



describe('/api/v1/users', function () {
  var userId;

  it('should save a new user', function (done) {
    request.post('/v1/users')
    .send({firstName: 'super', lastName: 'test'})
    .expect(201, function (err, res) {
      if (err){ return done(err); }
      userId = res.body._id;
      should(res.body).have.property('_id');
      done();
    });
  });


  it('should get list of users', function (done) {
    request.get('/v1/users')
    .expect(200, function (err, res) {
      if (err){ return done(err); }
      should(res.body).be.ok();
      done();
    });
  });


  it('should get a specific user', function (done) {
    request.get('/v1/users/' + userId)
    .expect(200, function (err, res) {
      if (err){ return done(err); }
      should(res.body).have.property('_id');
      done();
    });
  });


  it('should update a specific user', function (done) {
    request.put('/v1/users/' + userId)
    .send({firstName: 'supertest', lastName: 'updated'})
    .expect(200, function (err) {
      if (err){ return done(err); }
      done();
    });
  });


  it('should update a specific user', function (done) {
    request.delete('/v1/users/' + userId)
    .expect(204, function (err) {
      if (err){ return done(err); }
      done();
    });
  });
});
{'fraction_non_alphanumeric': 0.20473157415832574, 'fraction_numerical': 0.015165301789505611, 'mean_word_length': 2.9830917874396135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7478149', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1076, 'n_words': 256}