<commit_before>// 'use strict';
var expect = chai.expect;

describe("World", function() {

	beforeEach(function() {
		this.sandbox = sinon.sandbox.create();
		this.world = new World();
		this.b = this.sandbox.stub(B, 'sense');
	})

	afterEach(function() {
		this.sandbox.restore();
	})

	describe("constructor", function() {

		it("initializes 2x 'B' entities & stores them in this.entities", function() {
			expect(this.world.entities[0].klass).to.eq('b');
			expect(this.world.entities[1].klass).to.eq('b');
		})

		it("sends command to viewModel() with correct params", function() {
			var renderEntities = this.sandbox.spy(World.prototype, 'renderEntities');
			world = new World;
			expect(world.renderEntities.called).to.be.true;
			World.prototype.renderEntities.restore();
		})
	})

	describe("#initializeEntities()", function() {
		it("returned array is not empty", function() {
			var response = world.initializeEntities();
			expect(response).to.not.be.empty;
		})<commit_msg>World#constructor testing, stub b, let initialize entities be called and make stubbed Bs<commit_after>// 'use strict';
var expect = chai.expect;

describe("World", function() {

	beforeEach(function() {
		this.sandbox = sinon.sandbox.create();
		this.world = new World();
		// this.b = new B(this.world)
		// console.log(this.sandbox);
		this.b = sinon.createStubInstance(B); // think this works
		// console.log(window.B);
		this.sandbox.stub(window, "B" ).returns(this.b);  // not working
	})

	afterEach(function() {
		this.sandbox.restore();
	})

	describe("constructor", function() {

		it("initializes 2x 'B' entities & stores them in this.entities", function() {
			console.log(this.world.entities[0]);
			console.log(this.b);
			expect(this.world.entities[0]).to.eq(this.b);
			expect(this.world.entities[1]).to.eq(tihs.b);
		})

		it("sends command to viewModel() with correct params", function() {
			var renderEntities = this.sandbox.spy(World.prototype, 'renderEntities');
			world = new World;
			expect(world.renderEntities.called).to.be.true;
			World.prototype.renderEntities.restore();
		})
	})

	describe("#initializeEntities()", function() {
		it("returned array is not empty", function() {
			var response = world.initializeEntities();
			expect(response).to.not.be.empty;
		})
{'fraction_non_alphanumeric': 0.17294220665499124, 'fraction_numerical': 0.003064798598949212, 'mean_word_length': 4.313953488372093, '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': '2597273', 'n_tokens_mistral': 824, 'n_tokens_neox': 755, 'n_words': 148}