var should = require('should');
var registerUser = require('../lib/register/register-user');
var changeTheme = require('../lib/settings/change-theme');
var deleteUser = require('../lib/settings/delete-user');
var publishResume = require('../lib/publish/publish-resume');


describe('Register tests', function() {
  this.timeout(3000);

  var user = {
    username: 'test1',
    email: 'test1@test1.com',
    password: 'test1'
  };

  it('should register user', function(done) {

    registerUser(user, function(err, res) {
      should.not.exist(err);
      user.username.should.be.exactly(res.username);
      user.email.should.be.exactly(res.email);

      done();
    });
  });

  it('should change theme', function(done) {

    changeTheme({
      email: user.email,
      password: user.password,
      theme: 'flat',
      changeTheme: true
    }, function(err, res) {

      should.not.exist(err);

      console.log(err, res.body);

      done();

    });

  });

  it('should publish guest resume', function(done) {

    var resumeJson = require('./resume.json');
    var theme = 'flat'
    var email = null;
    var password = null;
    var guest = true;
    var resumePassword = false;
    var session = null;

    publishResume(resumeJson, theme, email, password, guest, resumePassword, session, function(err, res) {
      should.not.exist(err);
      res.body.should.have.property('url');

      done();
      // remove geust resume
    });
  });

  it('should delete user', function(done) {

    deleteUser({
      email: user.email,
      password: user.password
    }, function(err, res) {
      should.not.exist(err);

      done();
    });
  });
});

@@ -141,24 +141,89 @@
 ge-theme');%0A
+var changePassword = require('../lib/settings/change-password');%0A
 var deleteUs
@@ -330,17 +330,16 @@
 ume');%0A%0A
-%0A
 describe
@@ -1012,25 +1012,24 @@
 done();%0A
-%0A
     %7D);%0A
 %0A  %7D);%0A%0A
@@ -1020,16 +1020,603 @@
     %7D);%0A
+  %7D);%0A%0A  it('should change password', function(done) %7B%0A%0A    var newPassword = 'arbitraryString';%0A%0A    var data = %7B%0A      email: user.email,%0A      currentPassword: user.password,%0A      newPassword: newPassword,%0A      confirmPassword: newPassword%0A    %7D;%0A%0A    // update password on user object%0A    user.password = newPassword;%0A%0A    changePassword(data, function(err, res) %7B%0A      should.not.exist(err);%0A      res.statusCode.should.be.exactly(200);%0A      res.body.should.have.property('message', 'password updated');%0A%0A      console.log(err, res.statusCode, res.body);%0A%0A      done();%0A%0A    %7D);
 %0A  %7D);%0A%0A

add test for change-password