<commit_before>'use strict';

var assert = require('assert');

var cheerio = require('cheerio');
var express = require('express');
var request = require('supertest');
var uuid = require('uuid');

var helpers = require('../helpers');
var stormpath = require('../../index');

function requestVerifyPage(app,sptoken){
  var config = app.get('stormpathConfig');
  return request(app)
    .get(config.web.verifyEmail.uri + (sptoken?('?sptoken='+sptoken):''));
}

function assertVerifyFormExists(res) {
  var $ = cheerio.load(res.text);
  // Assert that the form was rendered.
  assert.equal($('input[name="email"]').length, 1);
}

function assertSpTokenWarning(res){
  var $ = cheerio.load(res.text);
  // Assert that the form was rendered.
  assert.equal($('.invalid-sp-token-warning').length, 1);
}

function assertInvalidEmailError(res){
  var $ = cheerio.load(res.text);
  // Assert that the error was shown
  assert($('.alert-danger').html().match(/Please enter a valid email address/));
}

describe('email verification', function() {
  var stormpathApplication;
  var stormpathClient;

  before(function (done) {
    stormpathClient = helpers.createClient();

    stormpathClient.on('error', function (err) {
      throw err;
    });

    stormpathClient.on('ready', function () {
      helpers.createApplication(stormpathClient, function (err, app) {
        if (err) {
          return done(err);
        }

        stormpathApplication = app;

        helpers.setEmailVerificationStatus(stormpathApplication, 'ENABLED', done);
      });
    });
  });

  after(function(done) {
    if (stormpathApplication) {
      helpers.destroyApplication(stormpathApplication, done);
    } else {
      done();
    }
  });

  it('should show an "unverified" message after registration', function(done) {
    var app = helpers.createStormpathExpressApp({
      application: {
        href: stormpathApplication.href
      },
      web: {
        register: {
          enabled: true
        }
      }
    });

    app.on('stormpath.ready', function() {<commit_msg>fix unnecessary test check<commit_after>'use strict';

var assert = require('assert');

var cheerio = require('cheerio');
var express = require('express');
var request = require('supertest');
var uuid = require('uuid');

var helpers = require('../helpers');
var stormpath = require('../../index');

function requestVerifyPage(app,sptoken){
  var config = app.get('stormpathConfig');
  return request(app)
    .get(config.web.verifyEmail.uri + (sptoken?('?sptoken='+sptoken):''));
}

function assertVerifyFormExists(res) {
  var $ = cheerio.load(res.text);
  // Assert that the form was rendered.
  assert.equal($('input[name="email"]').length, 1);
}

function assertSpTokenWarning(res){
  var $ = cheerio.load(res.text);
  // Assert that the form was rendered.
  assert.equal($('.invalid-sp-token-warning').length, 1);
}

function assertInvalidEmailError(res){
  var $ = cheerio.load(res.text);
  // Assert that the error was shown
  assert($('.alert-danger').html().match(/Please enter a valid email address/));
}

describe('email verification', function() {
  var stormpathApplication;
  var stormpathClient;

  before(function (done) {
    stormpathClient = helpers.createClient();

    stormpathClient.on('error', function (err) {
      throw err;
    });

    stormpathClient.on('ready', function () {
      helpers.createApplication(stormpathClient, function (err, app) {
        if (err) {
          return done(err);
        }

        stormpathApplication = app;

        helpers.setEmailVerificationStatus(stormpathApplication, 'ENABLED', done);
      });
    });
  });

  after(function(done) {
    helpers.destroyApplication(stormpathApplication, done);
  });

  it('should show an "unverified" message after registration', function(done) {
    var app = helpers.createStormpathExpressApp({
      application: {
        href: stormpathApplication.href
      },
      web: {
        register: {
          enabled: true
        }
      }
    });

    app.on('stormpath.ready', function() {
{'fraction_non_alphanumeric': 0.15177690029615004, 'fraction_numerical': 0.0009871668311944718, 'mean_word_length': 3.4834070796460175, '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': '4929077', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1200, 'n_words': 259}