<commit_before>/*!
 * 
 * @author <NAME> <<EMAIL>>
 * @date 11/15/15
 */
/* global define, describe, beforeEach, afterEach, it, assert, sinon, teoBase  */

"use strict";

const
    AppExtensions = require(`${teoBase}/teo.app.extensions`);

describe("Testing Teo App Extensions", () => {

    let extensions,
        extension = () => {
            return {
                // is used in app config with this namespace
                configNamespace: "my-module-config",
                // module's config
                config: {
                    "myParam": "1"
                },
                extension: function(app) {
                    app.middleware(function* (next) {
                        this.req.setHeader("X-Powered-By", "Teo.js");
                        yield next;
                    });
                }
            }
        },
        configGetStub;

    beforeEach(() => {

        configGetStub = sinon.stub();

        extensions = new AppExtensions({
            config: {
                get: configGetStub
            },
            app: {
                test: "true"
            }
        });

        configGetStub.withArgs("localExtensionsDirPath").returns("/extensions");
        configGetStub.withArgs("appDir").returns("/myAppDir");
        configGetStub.withArgs("extensions").returns(
            [
                {
                    "name": "my-extension-1",
                    "module": "my-module-name-1"
                },
                {
                    "name": "my-extension-2",
                    "file": "my-module-name-2"
                }
            ]
        );

    });

    afterEach(() => {

        extensions = null;
        configGetStub = null;

    });

    it.only("Should resolve passed extensions on initialization", () => {

        let addStub = sinon.stub(AppExtensions.prototype, "add", () => {});

        extensions = new AppExtensions({
            config: {
                get: configGetStub
            },
            app: {
                test: "true"<commit_msg>minor<commit_after>/*!
 * 
 * @author <NAME> <<EMAIL>>
 * @date 11/15/15
 */
/* global define, describe, beforeEach, afterEach, it, assert, sinon, teoBase  */

"use strict";

const
    AppExtensions = require(`${teoBase}/teo.app.extensions`);

describe("Testing Teo App Extensions", () => {

    let extensions,
        extension = () => {
            return {
                // is used in app config with this namespace
                configNamespace: "my-module-config",
                // module's config
                config: {
                    "myParam": "1"
                },
                extension: function(app) {
                    app.middleware(function* (next) {
                        this.req.setHeader("X-Powered-By", "Teo.js");
                        yield next;
                    });
                }
            }
        },
        configGetStub;

    beforeEach(() => {

        configGetStub = sinon.stub();

        extensions = new AppExtensions({
            config: {
                get: configGetStub
            },
            app: {
                test: "true"
            }
        });

        configGetStub.withArgs("localExtensionsDirPath").returns("/extensions");
        configGetStub.withArgs("appDir").returns("/myAppDir");
        configGetStub.withArgs("extensions").returns(
            [
                {
                    "name": "my-extension-1",
                    "module": "my-module-name-1"
                },
                {
                    "name": "my-extension-2",
                    "file": "my-module-name-2"
                }
            ]
        );

    });

    afterEach(() => {

        extensions = null;
        configGetStub = null;

    });

    it("Should resolve passed extensions on initialization", () => {

        let addStub = sinon.stub(AppExtensions.prototype, "add", () => {});

        extensions = new AppExtensions({
            config: {
                get: configGetStub
            },
            app: {
                test: "true"
{'fraction_non_alphanumeric': 0.13217688736867822, 'fraction_numerical': 0.005375030539946249, 'mean_word_length': 1.225, 'pattern_counts': {'":': 10, '<': 9, '<?xml version=': 0, '>': 21, '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': '963671', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1044, 'n_words': 197}