<commit_before>// jshint mocha:true

var nano = require('./lib/nanotest');
var expect = require('chai').expect;

const ConfigService = global['ConfigService'];

module.exports = function() {

  describe("Reset password", function() {

    before(function() {
      ConfigService.set('testSendMail', true);
    });

    const expectedSchema = {};

    describe("Create a reset password token", function() {

      it('Should return empty meta', function(done) {

        // create user for testing
        nano.request(sails.hooks.http.app)
        .post('/api/users')
        .send({
          data: {
            attributes: {
              'first-name': "Firstname",
              'last-name': "Lastname",
              'email': "<EMAIL>",
              'password': "<PASSWORD>",
              'is-admin': false
            },
            type: 'users'
          }
        })
        .set(nano.adminLogin())
        .expect(201)

        // test token creation
        .then(() => {
          // adding token to 'reset-password' table
          nano.request(sails.hooks.http.app)
          .post('/api/reset-passwords')
          .send({
            data: {
              attributes: {
                'email': "<EMAIL>",
                'password': <PASSWORD>,
              },
              type: 'reset-password'
            }
          })
          .set(nano.adminLogin())
          .expect(200)
          .expect(nano.jsonApiSchema(expectedSchema))
          .then(() => {
            // token has been added to 'reset-password' table
            return (nano.request(sails.hooks.http.app)
              .get('/api/reset-passwords')
              .set(nano.adminLogin())
              .expect(200)
              .expect(nano.jsonApiSchema(expectedSchema))
              .expect((res) => {
                console.log(res.body.data[0]);
                expect(res.body.data[0].attributes["email"])
                  .to.equal('<EMAIL>.');
              })
            );
          });
        })
        .then(() => {
          return done(); 
        })
        .catch((err) => {
          console.log("failure");
          console.log(err);
        });
      });
    });

    after(function() {
      ConfigService.unset('testSendMail');
    });
  });
};
<commit_msg>Fix reset-password test with jshint.<commit_after>// jshint mocha:true
// global: ConfigService

var nano = require('./lib/nanotest');
var expect = require('chai').expect;

module.exports = function() {

  describe("Reset password", function() {

    before(function() {
      ConfigService.set('testSendMail', true);
    });

    const expectedSchema = {};

    describe("Create a reset password token", function() {

      it('Should return empty meta', function(done) {

        // create user for testing
        nano.request(sails.hooks.http.app)
        .post('/api/users')
        .send({
          data: {
            attributes: {
              'first-name': "Firstname",
              'last-name': "Lastname",
              'email': "<EMAIL>",
              'password': "<PASSWORD>",
              'is-admin': false
            },
            type: 'users'
          }
        })
        .set(nano.adminLogin())
        .expect(201)

        // test token creation
        .then(() => {
          // adding token to 'reset-password' table
          nano.request(sails.hooks.http.app)
          .post('/api/reset-passwords')
          .send({
            data: {
              attributes: {
                'email': "<EMAIL>",
                'password': <PASSWORD>,
              },
              type: 'reset-password'
            }
          })
          .set(nano.adminLogin())
          .expect(200)
          .expect(nano.jsonApiSchema(expectedSchema))
          .then(() => {
            // token has been added to 'reset-password' table
            return (nano.request(sails.hooks.http.app)
              .get('/api/reset-passwords')
              .set(nano.adminLogin())
              .expect(200)
              .expect(nano.jsonApiSchema(expectedSchema))
              .expect((res) => {
                console.log(res.body.data[0]);
                expect(res.body.data[0].attributes["email"])
                  .to.equal('<EMAIL>.');
              })
            );
          });
        })
        .then(() => {
          return done(); 
        })
        .catch((err) => {
          console.log("failure");
          console.log(err);
        });
      });
    });

    after(function() {
      ConfigService.unset('testSendMail');
    });
  });
};

{'fraction_non_alphanumeric': 0.15846153846153846, 'fraction_numerical': 0.004835164835164835, 'mean_word_length': 1.4272, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, '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': '4101532', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1243, 'n_words': 213}