<commit_before>define(["src/class"], function (createClass) {
	"use strict";

	describe("createClass", function () {
		var Foo = createClass(function () {
				this.id = 1;
			});
		it("creates a class constructor", function () {
			expect(typeof Foo).toBe("function");
			expect(typeof Foo.prototype).toBe("object");
		});
		it("can be called or without either optional params (options, init)", function () {
			var Bar = createClass(),
				Hello = createClass({
					name: "Bar"
				});
			expect(typeof Bar).toBe("function");
			expect(typeof Bar.prototype).toBe("object");
			expect(typeof Hello).toBe("function");
			expect(typeof Hello.prototype).toBe("object");
		});
		it("invokes passed in init function", function () {
			var foo = new Foo();
			expect(foo.id).toBe(1);
		});
		it("allows new to be optional", function () {
			var bar = createClass(),
				barInstance = bar();
			expect(barInstance instanceof bar).toBe(true);
		});
	});
});<commit_msg>finishing out testing createClass capabilities<commit_after>define(["src/class"], function (createClass) {
	"use strict";

	describe("createClass()", function () {
		it("creates a class constructor", function () {
			var Foo = createClass(function () {
				this.id = 1;
			});
			useClass(Foo);
		});

		it("can be called without params", function () {
			var Foo = createClass();
			useClass(Foo);
		});

		it("can be called without options param", function () {
			var Foo = createClass(function () {});
			useClass(Foo);
		});

		it("can be called without init param", function () {
			var Foo = createClass({
				name: "Foo"
			});
			useClass(Foo);
		});

		it("can be called passing both options and init", function () {
			var Foo = createClass({}, function () {});
			useClass(Foo);
		});
	});

	describe("classes created with createClass()", function () {
		it("can extend a super class", function () {
			var Foo = createClass({
					name: "Foo"
				}, fooInit),
				Bar = createClass({
					"extends": Foo
				});
			function fooInit () {}
			useClass(Foo);
			useClass(Bar);
			expect(new Bar() instanceof Foo).toBe(true);
		});

		it("can be decorated with a mixins object", function () {
			var Foo = createClass({
					name: "Foo"
				}, fooInit),
				mixin = {
					sayHello: function () {
						return "Hello";
					}
				},
				Bar = createClass({
					"extends": Foo,
					"mixins": mixin
				});
			function fooInit () {}
			useClass(Foo);
			useClass(Bar);
			expect(new Bar() instanceof Foo).toBe(true);
			expect(new Bar().sayHello()).toBe("Hello");
		});

		it("can be decorated with a mixins array", function () {
			var Foo = createClass({
					name: "Foo"
				}),
				mixins = [{
					sayHello: function () {
						return "Hello";
					}
				}, {
					getId: function () {
						return this.id;
					}
				}],
				Bar = createClass({
					"extends": Foo,
					"mixins": mixins
				}, initBar);
			function initBar () {
				this.id = 1;
			}
			useClass(Foo);
			useClass(Bar);
			expect(new Bar() instanceof Foo).toBe(true);
			expect(new Bar().sayHello()).toBe("Hello");
			expect(new Bar().getId()).toBe(1);
		});

		it("can be decorated with a mixins class", function () {
			var Foo,
				Bar = createClass();
			Bar.prototype.getId = function () {
				return this.id;
			};
			Foo = createClass({
				name: "Foo",
				mixins: Bar
			}, fooInit);
			function fooInit () {
				this.id = 1;
			}
			useClass(Foo);
			useClass(Bar);
			expect(new Foo().getId()).toBe(1);
		});
	});

	describe("class constructors created with createClass()", function () {
		it("are inject with class name", function () {
			var Foo = createClass({
				name: "Foo"
			}, function () {});
			expect(Foo.toString().indexOf("function Foo")).toBe(0);
		});

		it("invoke init function", function () {
			var Foo = createClass(function () {
					this.id = 1;
				}),
				foo = new Foo();
			useClass(Foo);
			expect(foo.id).toBe(1);
		});

		it("can be called with or with new operator", function () {
			var foo = createClass(),
				fooInstance = foo();
			expect(fooInstance instanceof foo).toBe(true);
		});
	});

	function useClass (Constructor) {
		expect(typeof Constructor).toBe("function");
		expect(typeof Constructor.prototype).toBe("object");
		expect(new Constructor() instanceof Constructor).toBe(true);
	}
});
{'fraction_non_alphanumeric': 0.17412587412587413, 'fraction_numerical': 0.002331002331002331, 'mean_word_length': 3.145893719806763, 'pattern_counts': {'":': 5, '<': 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': '86115', 'n_tokens_mistral': 1712, 'n_tokens_neox': 1322, 'n_words': 342}