<commit_before>describe("Core Provider Integration", function() {
  var freedom_src;

  var freedom;
  beforeEach(function() {
    freedom_src = getFreedomSource();
    
    var global = {
      console: {
        log: function() {}
      },
      document: document
    };
  
    setupResolvers();

    var path = window.location.href,
        dir_idx = path.lastIndexOf('/'),
        dir = path.substr(0, dir_idx) + '/';
    freedom = fdom.setup(global, undefined, {
      manifest: "relative://spec/helper/channel.json",
      portType: 'Frame',
      inject: dir + "node_modules/grunt-contrib-jasmine/node_modules/es5-shim/es5-shim.js",
      src: freedom_src
    });
  });
  
  afterEach(function() {
    var frames = document.getElementsByTagName('iframe');
    for (var i = 0; i < frames.length; i++) {
      frames[i].parentNode.removeChild(frames[i]);
    }
  });

  it("Manages Channels Between Modules", function(done) {
    var cb = jasmine.createSpy('cb');
    freedom.once('message', function(msg) {
      // created.
      expect(msg).toEqual('creating custom channel 0');
      freedom.on('message', cb);
      freedom.on('message', function() {
        expect(cb).toHaveBeenCalledWith('sending message to 0');
        done();
      });
      freedom.emit('message', 0);
    });
    freedom.emit('create');
  });

  it("Manages Channels With providers", function(done) {
    var cb = jasmine.createSpy('cb');
    freedom.once('message', function(msg) {
      // created.
      freedom.on('message', cb);
      freedom.once('message', function() {
        expect(cb).toHaveBeenCalledWith('sending message to peer 0');
        done();
      });
      freedom.emit('message', 0);
    });
    freedom.emit('peer');
  });
});

describe("Core Provider Channels", function() {
  var manager, hub, global, source, core;
  beforeEach(function(done) {
    global = {freedom: {}, document: document};
    hub = new fdom.Hub();
    manager = new fdom.port.Manager(hub);
    hub.emit('config', {
      global: global
    });
    source = createTestPort('test');
    manager.setup(source);

    var chan = source.gotMessage('control').channel;
    hub.onMessage(chan, {
      type: 'Core Provider',
      request: 'core'<commit_msg>core provider tests should ensure debug is set up<commit_after>describe("Core Provider Integration", function() {
  var freedom_src;

  var freedom;
  beforeEach(function() {
    freedom_src = getFreedomSource();
    fdom.debug = new fdom.port.Debug();
    
    var global = {
      console: {
        log: function() {}
      },
      document: document
    };
  
    setupResolvers();

    var path = window.location.href,
        dir_idx = path.lastIndexOf('/'),
        dir = path.substr(0, dir_idx) + '/';
    freedom = fdom.setup(global, undefined, {
      manifest: "relative://spec/helper/channel.json",
      portType: 'Frame',
      inject: dir + "node_modules/grunt-contrib-jasmine/node_modules/es5-shim/es5-shim.js",
      src: freedom_src
    });
  });
  
  afterEach(function() {
    var frames = document.getElementsByTagName('iframe');
    for (var i = 0; i < frames.length; i++) {
      frames[i].parentNode.removeChild(frames[i]);
    }
  });

  it("Manages Channels Between Modules", function(done) {
    var cb = jasmine.createSpy('cb');
    freedom.once('message', function(msg) {
      // created.
      expect(msg).toEqual('creating custom channel 0');
      freedom.on('message', cb);
      freedom.on('message', function() {
        expect(cb).toHaveBeenCalledWith('sending message to 0');
        done();
      });
      freedom.emit('message', 0);
    });
    freedom.emit('create');
  });

  it("Manages Channels With providers", function(done) {
    var cb = jasmine.createSpy('cb');
    freedom.once('message', function(msg) {
      // created.
      freedom.on('message', cb);
      freedom.once('message', function() {
        expect(cb).toHaveBeenCalledWith('sending message to peer 0');
        done();
      });
      freedom.emit('message', 0);
    });
    freedom.emit('peer');
  });
});

describe("Core Provider Channels", function() {
  var manager, hub, global, source, core;
  beforeEach(function(done) {
    global = {freedom: {}, document: document};
    fdom.debug = new fdom.port.Debug();
    hub = new fdom.Hub();
    manager = new fdom.port.Manager(hub);
    hub.emit('config', {
      global: global
    });
    source = createTestPort('test');
    manager.setup(source);

    var chan = source.gotMessage('control').channel;
    hub.onMessage(chan, {
      type: 'Core Provider',
      request: 'core'
{'fraction_non_alphanumeric': 0.16273996509598604, 'fraction_numerical': 0.003926701570680628, 'mean_word_length': 2.8368200836820083, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1986273', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1430, 'n_words': 289}