<commit_before>/*global chai, sinon, PortCollection, tkWorker, onconnect */

var expect = chai.expect;

describe("Frame Worker Events", function() {
  describe("#onconnect", function() {
    "use strict";
    var sandbox, event, ports, oldPorts;

    beforeEach(function() {
      sandbox = sinon.sandbox.create();

      event = {
        ports: [{_portid: 1}]
      };

      ports = new PortCollection();
      oldPorts = tkWorker.ports;
      tkWorker.ports = ports;

      sandbox.stub(tkWorker, "loadSPA");
    });

    afterEach(function() {
      tkWorker.ports = oldPorts;
      sandbox.restore();
    });

    it("should add the port to the tkWorker ports", function () {
      onconnect(event);

      expect(ports.find(1).id).to.equal(1);
    });

    it("should load the SPA details", function() {
      onconnect(event);

      sinon.assert.calledOnce(tkWorker.loadSPA);<commit_msg>Move use strict up a level<commit_after>/*global chai, sinon, PortCollection, tkWorker, onconnect */

var expect = chai.expect;

describe("Frame Worker Events", function() {
  "use strict";

  describe("#onconnect", function() {
    var sandbox, event, ports, oldPorts;

    beforeEach(function() {
      sandbox = sinon.sandbox.create();

      event = {
        ports: [{_portid: 1}]
      };

      ports = new PortCollection();
      oldPorts = tkWorker.ports;
      tkWorker.ports = ports;

      sandbox.stub(tkWorker, "loadSPA");
    });

    afterEach(function() {
      tkWorker.ports = oldPorts;
      sandbox.restore();
    });

    it("should add the port to the tkWorker ports", function () {
      onconnect(event);

      expect(ports.find(1).id).to.equal(1);
    });

    it("should load the SPA details", function() {
      onconnect(event);

      sinon.assert.calledOnce(tkWorker.loadSPA);
{'fraction_non_alphanumeric': 0.14412416851441243, 'fraction_numerical': 0.0033259423503325942, 'mean_word_length': 2.8486140724946694, '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': '2133288', 'n_tokens_mistral': 591, 'n_tokens_neox': 563, 'n_words': 126}