<commit_before>var assert = require('assert');

var msg = require('../msg.js');
var subController = require('../controller.js');
var testAdapter = require('./testAdapter.js');
var events = require('../../../events.js');

var controller = subController(testAdapter);

//-----------------------------------------------------------------------------
// Registration Controller Tests

describe('===> Testing Register subscriber controller: \n', function(){

  it('Register Subscriber success', function(done){
		var testId = 'testerID';
    var data = {email: '<EMAIL>', password: '<PASSWORD>'};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), JSON.stringify({value:{},tunnel:{}}));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});

  it('Missing Email Test', function(done){
		var testId = 'testerID1';
    var data = {email: '', password: '<PASSWORD>'};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), JSON.stringify(msg.missingEmail()));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});

  it('Bad Email Test', function(done){
		var testId = 'testerID2';
    var data = {email: 'a_terrible_email', password: '<PASSWORD>'};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), 
								 JSON.stringify(msg.badEmail(data.email)));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});


  it('Missing Password Test', function(done){
		var testId = 'testerID3';
    var data = {email: '<EMAIL>', password: ''};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), 
								 JSON.stringify(msg.missingPwd()));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});


  it('Bad Password Test', function(done){
		var testId = 'testerID4';
    var data = {email: '<EMAIL>', password: '<PASSWORD>'};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), 
								 JSON.stringify(msg.badPwd()));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});
});

// ----------------------------------------------------------------------------
// Verification Test
describe('===> Testing Verify subscriber controller: \n', function(){
	
	it('Bad Token Test', function(done){
		var testId = 'testerID1';
	    	var data = {};
	    	var params = ['doesnt_matter_only_looking_for_params1', 'an_invalid_token'];
		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result),
		JSON.stringify(msg.badVerificationToken()));
		done();
		});
	  controller.module.noauth.verify('POST', params, data, '127.0.0.1', testId);
	});
	
	it('Missing Token Test', function(done){
		var testId = 'testerID2';
	    	var data = {};
	    	var params = ['doesnt_matter_only_looking_for_params1', ''];
		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result),
		JSON.stringify(msg.missingVerificationToken()));
		done();
		});
	  controller.module.noauth.verify('POST', params, data, '127.0.0.1', testId);
	});
});<commit_msg>Update controllerTest.js<commit_after>var assert = require('assert');

var msg = require('../msg.js');
var subController = require('../controller.js');
var testAdapter = require('./testAdapter.js');
var events = require('../../../events.js');

var controller = subController(testAdapter);

//-----------------------------------------------------------------------------
// Registration Controller Tests

describe('===> Testing Register subscriber controller: \n', function(){

  it('Register Subscriber success', function(done){
		var testId = 'testerID';
    var data = {email: '<EMAIL>', password: '<PASSWORD>'};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), JSON.stringify({value:{},tunnel:{}}));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});

  it('Missing Email Test', function(done){
		var testId = 'testerID1';
    var data = {email: '', password: '<PASSWORD>'};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), JSON.stringify(msg.missingEmail()));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});

  it('Bad Email Test', function(done){
		var testId = 'testerID2';
    var data = {email: 'a_terrible_email', password: '<PASSWORD>'};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), 
								 JSON.stringify(msg.badEmail(data.email)));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});


  it('Missing Password Test', function(done){
		var testId = 'testerID3';
    var data = {email: '<EMAIL>', password: ''};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), 
								 JSON.stringify(msg.missingPwd()));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});


  it('Bad Password Test', function(done){
		var testId = 'testerID4';
    var data = {email: '<EMAIL>', password: '<PASSWORD>'};

		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result), 
								 JSON.stringify(msg.badPwd()));
		done();
		});
  controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
	});
});

// ----------------------------------------------------------------------------
// Verification Test
describe('===> Testing Verify subscriber controller: \n', function(){
	
	it('Bad Token Test', function(done){
		var testId = 'testerID1';
	    	var data = {};
	    	var params = ['doesnt_matter_only_looking_for_params1', 'an_invalid_token'];
		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result),
		JSON.stringify(msg.badVerificationToken()));
		done();
		});
	  controller.module.noauth.verify('POST', params, data, '127.0.0.1', testId);
	});
	
	it('Missing Token Test', function(done){
		var testId = 'testerID2';
	    	var data = {};
	    	var params = ['doesnt_matter_only_looking_for_params1', ''];
		events.Emitter.once(testId, function(result){
		assert.equal(JSON.stringify(result),
		JSON.stringify(msg.missingVerificationToken()));
		done();
		});
	  controller.module.noauth.verify('POST', params, data, '127.0.0.1', testId);
	});
});

// --------------------------------------------------------------------------------
// Login Test
describe('===> Testing Login subscriber controller: \n', function(){
	
}
{'fraction_non_alphanumeric': 0.24546408756935073, 'fraction_numerical': 0.0149947518368571, 'mean_word_length': 3.35378590078329, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 14, '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': '3308394', 'n_tokens_mistral': 2243, 'n_tokens_neox': 2044, 'n_words': 390}