{"size": 619, "ext": "js", "max_stars_repo_path": "generators/authentication/templates/test/unit/models/User.test.js", "max_stars_repo_name": "italoag/generator-sails-rest-api", "max_stars_repo_stars_event_min_datetime": "2018-07-03T02:50:34.000Z", "max_stars_repo_stars_event_max_datetime": "2018-07-03T02:50:34.000Z", "max_issues_repo_path": "generators/authentication/templates/test/unit/models/User.test.js", "max_issues_repo_name": "italoag/generator-sails-rest-api", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "generators/authentication/templates/test/unit/models/User.test.js", "max_forks_repo_name": "italoag/generator-sails-rest-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.34375, "max_line_length": 58, "alphanum_fraction": 0.5508885299}
"use strict";

const assert = require('chai').assert;

const newUser = {
  username: 'modelTest',
  password: 'password',
  email: 'modelTest@gmail.com'
};

describe('models:User', () => {
  it('Should create new user', done => {
    User
      .create(newUser)
      .then(user => {
        assert.equal(user.username, newUser.username);
        done();
      })
      .catch(done);
  });

  it('Should remove user', done => {
    User
      .destroy({username: newUser.username})
      .then(users => {
        assert.equal(users[0].username, newUser.username);
        done();
      })
      .catch(done);
  });
});
