<commit_before>/*global describe, it, expect, example, before, after, beforeEach, afterEach, mocha, sinon*/
'use strict';
var assert = require('chai').assert;
var Raven = require('raven-js');
var $ = require('jquery');
var m = require('mithril');
var AddProject = require('js/addProjectPlugin');

//console.log(AddProject);
describe('AddProjectPlugin', () => {
    it('should validate if new project name is not empty', () => {
        var project = new AddProject.controller();
        project.newProjectName('Hello');
        project.checkValid();
        assert.ok(project.isValid(), true);
        project.newProjectName('');
        project.checkValid();
        assert.notOk(project.isValid(), false);
    });
    it('should load project categories from api server', () => {
        var project = new AddProject.controller();
        var promise = project.loadCategories();
        promise.then(function(){
            assert.ok(project.categoryList.length > 0);
            console.log(project.categoryList);
        });
    });
});<commit_msg>Add reset testing to addProjectPlugin<commit_after>/*global describe, it, expect, example, before, after, beforeEach, afterEach, mocha, sinon*/
'use strict';
var assert = require('chai').assert;
var Raven = require('raven-js');
var $ = require('jquery');
var m = require('mithril');
var AddProject = require('js/addProjectPlugin');

//console.log(AddProject);
describe('AddProjectPlugin', () => {
    it('should validate if new project name is not empty', () => {
        var project = new AddProject.controller();
        project.newProjectName('Hello');
        project.checkValid();
        assert.ok(project.isValid(), true);
        project.newProjectName('');
        project.checkValid();
        assert.notOk(project.isValid(), false);
    });
    it('should load project categories from api server', () => {
        var project = new AddProject.controller();
        var promise = project.loadCategories();
        promise.then(function(){
            assert.ok(project.categoryList.length > 0);
            console.log(project.categoryList);
        });
    });
    it('should reset states and defaults when reset function runs', () => {
        var project = new AddProject.controller();
        // Change values
        project.newProjectName('Hello there');
        project.viewState('error');
        project.newProjectDesc('Description');
        project.newProjectCategory('thesis');
        // Reset
        project.reset();
        // Assert the return to defaults;
        assert.equal(project.newProjectName(), '');
        assert.equal(project.viewState(), 'form');
        assert.equal(project.newProjectDesc(), '');
        assert.equal(project.newProjectCategory(), 'project');
    });
});
{'fraction_non_alphanumeric': 0.15340086830680175, 'fraction_numerical': 0.000723589001447178, 'mean_word_length': 3.1392215568862274, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '6881726', 'n_tokens_mistral': 726, 'n_tokens_neox': 721, 'n_words': 173}