<commit_before>describe("Cosmos", function() {

  var _ = require('lodash'),
      jsdom = require('jsdom');

  // jsdom creates a fresh new window object for every test case and React needs
  // to be required *after* the window and document globals are available. The
  // var references however must be declared globally in order to be accessible
  // in test cases as well.
  var React,
      utils,
      Cosmos,
      DummyComponentClass;

  beforeEach(function() {
    global.window = jsdom.jsdom().createWindow('<html><body></body></html>');
    global.document = global.window.document;
    global.navigator = global.window.navigator;

    React = require('react/addons');
    utils = React.addons.TestUtils;
    Cosmos = require('../build/cosmos.js');

    DummyComponentClass = React.createClass({
      render: function() {
        return;
      }
    });
  });

  it("should draw its components from the Cosmos.components namespace", function() {
    Cosmos.components.Dummy = DummyComponentClass;
    expect(Cosmos.getComponentByName('Dummy')).toBe(DummyComponentClass);
  });

  it("should draw its components from lookup callback", function() {
    Cosmos.components.Dummy = DummyComponentClass;

    expect(Cosmos.getComponentByName('Dummy', function(name) {
      expect(name).toBe('Dummy');
      return DummyComponentClass;
    })).toBe(DummyComponentClass);
  });

  it("should create React element for component class", function() {
    spyOn(React, 'createElement')
         .and.returnValue(function(){});

    Cosmos({
      component: 'Dummy',
      componentLookup: function(name) {
        expect(name).toBe('Dummy');
        return DummyComponentClass;
      }<commit_msg>No need to add DummyComponent to namespace #73<commit_after>describe("Cosmos", function() {

  var _ = require('lodash'),
      jsdom = require('jsdom');

  // jsdom creates a fresh new window object for every test case and React needs
  // to be required *after* the window and document globals are available. The
  // var references however must be declared globally in order to be accessible
  // in test cases as well.
  var React,
      utils,
      Cosmos,
      DummyComponentClass;

  beforeEach(function() {
    global.window = jsdom.jsdom().createWindow('<html><body></body></html>');
    global.document = global.window.document;
    global.navigator = global.window.navigator;

    React = require('react/addons');
    utils = React.addons.TestUtils;
    Cosmos = require('../build/cosmos.js');

    DummyComponentClass = React.createClass({
      render: function() {
        return;
      }
    });
  });

  it("should draw its components from the Cosmos.components namespace", function() {
    Cosmos.components.Dummy = DummyComponentClass;
    expect(Cosmos.getComponentByName('Dummy')).toBe(DummyComponentClass);
  });

  it("should draw its components from lookup callback", function() {
    var componentLookup = function(name) {
      expect(name).toBe('Dummy');
      return DummyComponentClass;
    };
    expect(Cosmos.getComponentByName('Dummy', componentLookup))
          .toBe(DummyComponentClass);
  });

  it("should create React element for component class", function() {
    spyOn(React, 'createElement')
         .and.returnValue(function(){});

    Cosmos({
      component: 'Dummy',
      componentLookup: function(name) {
        expect(name).toBe('Dummy');
        return DummyComponentClass;
      }
{'fraction_non_alphanumeric': 0.1259819610125109, 'fraction_numerical': 0.0005819028222286878, 'mean_word_length': 3.3574144486692017, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6846817', 'n_tokens_mistral': 973, 'n_tokens_neox': 951, 'n_words': 246}