<commit_before>/**
 * Created by pmeijer on 4/2/2014.
 */
'use strict';
if (typeof window === 'undefined') {

    // server-side setup
    var requirejs = require("requirejs");
    requirejs.config({
        baseUrl: '.',
        // TODO: populate plugin list dynamically based on config.json
        paths: {
            "logManager": "common/LogManager",
            'plugin': 'node_modules/webgme/plugin',
            "plugin/Children.Dsml": "./src/plugins/CyPhyLight",
            "plugin/CyPhyLight": "./src/plugins/CyPhyLight",
            "plugin/ModelicaImporter": "./src/plugins/CyPhyLight",
            "plugin/ModelicaImporter.Dsml": "./src/plugins/CyPhyLight",
            "plugin/Children": "./src/plugins/Examples",
            "plugin/ChildrenConfig": "./src/plugins/Examples",
            "plugin/ChildrenSaveArtifacts": "./src/plugins/Examples",
            "plugin/DuplicateActiveNode": "./src/plugins/Examples",
            "plugin/UsingTemplates": "./src/plugins/Examples",
            "plugin/DSMLAPIGenerator": "./src/plugins/META",
            "plugin/GetPrintAllObjects": "./src/plugins/FMU",
            "plugin/ImportFMUs": "./src/plugins/FMU",
            "plugin/PetriNetExporter": "./src/plugins/PetriNet"
        },
        nodeRequire: require
    });

    var chai = require('chai'),
        should = chai.should(),
        assert = chai.assert,
        expect = chai.expect;
}

// /^v?((\d+)\.(\d+)\.(\d+))(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?$/
var semanticVersionPattern = /^\d+\.\d+\.\d+$/;

var pluginList = [
    'plugin/Children/Children/Children',
    'plugin/ChildrenConfig/ChildrenConfig/ChildrenConfig'];

describe("Test PluginBase API", function() {

    var PluginBase;
    before(function(done){

        requirejs(['plugin/PluginBase'], function(PluginBase_){
            PluginBase = PluginBase_;
            done();
        });
    });

    afterEach(function() {

    });

    it ('getVersion', function() {
        var pluginBase = new PluginBase();
        expect(semanticVersionPattern.test(pluginBase.getVersion())).to.be.true;
    });

    it ('getDescription', function() {
        var pluginBase = new PluginBase(),
            description = pluginBase.getDescription();
        expect(typeof description === 'string' || description instanceof String).to.be.true;
    });
});

// TODO: Generate these on the fly based on pluginList.<commit_msg>Add getName test case for base class.<commit_after>/**
 * Created by pmeijer on 4/2/2014.
 */
'use strict';
if (typeof window === 'undefined') {

    // server-side setup
    var requirejs = require("requirejs");
    requirejs.config({
        baseUrl: '.',
        // TODO: populate plugin list dynamically based on config.json
        paths: {
            "logManager": "common/LogManager",
            'plugin': 'node_modules/webgme/plugin',
            "plugin/Children.Dsml": "./src/plugins/CyPhyLight",
            "plugin/CyPhyLight": "./src/plugins/CyPhyLight",
            "plugin/ModelicaImporter": "./src/plugins/CyPhyLight",
            "plugin/ModelicaImporter.Dsml": "./src/plugins/CyPhyLight",
            "plugin/Children": "./src/plugins/Examples",
            "plugin/ChildrenConfig": "./src/plugins/Examples",
            "plugin/ChildrenSaveArtifacts": "./src/plugins/Examples",
            "plugin/DuplicateActiveNode": "./src/plugins/Examples",
            "plugin/UsingTemplates": "./src/plugins/Examples",
            "plugin/DSMLAPIGenerator": "./src/plugins/META",
            "plugin/GetPrintAllObjects": "./src/plugins/FMU",
            "plugin/ImportFMUs": "./src/plugins/FMU",
            "plugin/PetriNetExporter": "./src/plugins/PetriNet"
        },
        nodeRequire: require
    });

    var chai = require('chai'),
        should = chai.should(),
        assert = chai.assert,
        expect = chai.expect;
}

// /^v?((\d+)\.(\d+)\.(\d+))(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?$/
var semanticVersionPattern = /^\d+\.\d+\.\d+$/;

var pluginList = [
    'plugin/Children/Children/Children',
    'plugin/ChildrenConfig/ChildrenConfig/ChildrenConfig'];

describe("Test PluginBase API", function() {

    var PluginBase;
    before(function(done){

        requirejs(['plugin/PluginBase'], function(PluginBase_){
            PluginBase = PluginBase_;
            done();
        });
    });

    afterEach(function() {

    });

    it ('getVersion', function() {
        var pluginBase = new PluginBase();
        expect(semanticVersionPattern.test(pluginBase.getVersion())).to.be.true;
    });

    it ('getDescription', function() {
        var pluginBase = new PluginBase(),
            description = pluginBase.getDescription();
        expect(typeof description === 'string' || description instanceof String).to.be.true;
    });

    it ('getName', function() {
        var pluginBase = new PluginBase();
        (function () {
            pluginBase.getName()
        }).should.throw(Error);
    });
});

// TODO: Generate these on the fly based on pluginList.
{'fraction_non_alphanumeric': 0.18369351669941061, 'fraction_numerical': 0.002357563850687623, 'mean_word_length': 2.391738840772818, 'pattern_counts': {'":': 28, '<': 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': '1767025', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1496, 'n_words': 259}