<commit_before>/**
 * ComponentFactoryServiceTest
 *
 * Test Suite for the ComponentFactoryService
 *
 * @author hunter.novak
 * @since 2.0.0
 */

describe('Core', function() {

  describe('Wilson', function () {
    var rootScope     = null;
    var injector      = null;
    var compile       = null;
    var templateCache = null;

    // Establish Test Setup
    beforeEach(module('testWilson'));
    beforeEach(inject(function($injector) {
      injector      = $injector;
      rootScope     = $injector.get('$rootScope');
      compile       = $injector.get('$compile');
      templateCache = $injector.get('$templateCache');
    }));


    //   _____         _     _   _ _   _ _
    //  |_   _|__  ___| |_  | | | | |_(_) |___
    //    | |/ _ \/ __| __| | | | | __| | / __|
    //    | |  __/\__ \ |_  | |_| | |_| | \__ \
    //    |_|\___||___/\__|  \___/ \__|_|_|___/
    //
    // region test utils

    function createTestComponent(name, templateContent) {

      // Declare component on angular
      wilson.component(name, {
        controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {
          $scope.data = { test: 'SUCCESS' };
        }],

        link: function($scope, $element, $attrs, controller) {}
      });

      // Inject the template into the templateCache (simulating the external template file for testing purposes)
      templateCache.put(name, templateContent);

    }

    // endregion


    //   _____         _     ____        _ _
    //  |_   _|__  ___| |_  / ___| _   _(_) |_ ___
    //    | |/ _ \/ __| __| \___ \| | | | | __/ _ \
    //    | |  __/\__ \ |_   ___) | |_| | | ||  __/
    //    |_|\___||___/\__| |____/ \__,_|_|\__\___|
    //
    // region test suite

    runTest('Wilson-1000-01', 'Should have properly decorated the Wilson instance onto window and angular.', function() {

      // Check wilson is declared globally on the window
      expect(wilson).toBeDefined();

      // Ensure that wilson is a true Wilson functional class instance
      expect(wilson.constructor).toBeDefined();
      expect(typeof wilson.constructor).toBe('function');
      expect(wilson.constructor.name).toBe('Wilson');

      // Check that wilson is also declared onto angular
      expect(angular.wilson).toBeDefined();

      // Ensure that angular.wilson is a true Wilson functional class instance
      expect(angular.wilson.constructor).toBeDefined();
      expect(typeof angular.wilson.constructor).toBe('function');
      expect(angular.wilson.constructor.name).toBe('Wilson');

      // Make sure the reference is the same wilson on angular as on the window
      expect(angular.wilson).toBe(wilson);

    });


    runTest('Wilson-1000-02', 'Should not provide access to the Wilson function from the window.', function() {

      expect(window.Wilson).toBeUndefined();
      expect(window.angular.Wilson).toBeUndefined();<commit_msg>Updated text on wilson test 02<commit_after>/**
 * ComponentFactoryServiceTest
 *
 * Test Suite for the ComponentFactoryService
 *
 * @author hunter.novak
 * @since 2.0.0
 */

describe('Core', function() {

  describe('Wilson', function () {
    var rootScope     = null;
    var injector      = null;
    var compile       = null;
    var templateCache = null;

    // Establish Test Setup
    beforeEach(module('testWilson'));
    beforeEach(inject(function($injector) {
      injector      = $injector;
      rootScope     = $injector.get('$rootScope');
      compile       = $injector.get('$compile');
      templateCache = $injector.get('$templateCache');
    }));


    //   _____         _     _   _ _   _ _
    //  |_   _|__  ___| |_  | | | | |_(_) |___
    //    | |/ _ \/ __| __| | | | | __| | / __|
    //    | |  __/\__ \ |_  | |_| | |_| | \__ \
    //    |_|\___||___/\__|  \___/ \__|_|_|___/
    //
    // region test utils

    function createTestComponent(name, templateContent) {

      // Declare component on angular
      wilson.component(name, {
        controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {
          $scope.data = { test: 'SUCCESS' };
        }],

        link: function($scope, $element, $attrs, controller) {}
      });

      // Inject the template into the templateCache (simulating the external template file for testing purposes)
      templateCache.put(name, templateContent);

    }

    // endregion


    //   _____         _     ____        _ _
    //  |_   _|__  ___| |_  / ___| _   _(_) |_ ___
    //    | |/ _ \/ __| __| \___ \| | | | | __/ _ \
    //    | |  __/\__ \ |_   ___) | |_| | | ||  __/
    //    |_|\___||___/\__| |____/ \__,_|_|\__\___|
    //
    // region test suite

    runTest('Wilson-1000-01', 'Should have properly decorated the Wilson instance onto window and angular.', function() {

      // Check wilson is declared globally on the window
      expect(wilson).toBeDefined();

      // Ensure that wilson is a true Wilson functional class instance
      expect(wilson.constructor).toBeDefined();
      expect(typeof wilson.constructor).toBe('function');
      expect(wilson.constructor.name).toBe('Wilson');

      // Check that wilson is also declared onto angular
      expect(angular.wilson).toBeDefined();

      // Ensure that angular.wilson is a true Wilson functional class instance
      expect(angular.wilson.constructor).toBeDefined();
      expect(typeof angular.wilson.constructor).toBe('function');
      expect(angular.wilson.constructor.name).toBe('Wilson');

      // Make sure the reference is the same wilson on angular as on the window
      expect(angular.wilson).toBe(wilson);

    });


    runTest('Wilson-1000-02', 'Should not provide access to the Wilson constructor function externally on the window.', function() {

      expect(window.Wilson).toBeUndefined();
      expect(window.angular.Wilson).toBeUndefined();
{'fraction_non_alphanumeric': 0.14774281805745554, 'fraction_numerical': 0.005471956224350205, 'mean_word_length': 2.3045197740112995, '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': '6514262', 'n_tokens_mistral': 1865, 'n_tokens_neox': 1720, 'n_words': 356}