<commit_before>var assert = require('assert');
var IOC = require('../index');

var stubModule = { hello: 'world' };

describe("The NoDice IOC object", function () {
	it("should exist globally", function () {
		assert(typeof(IOC) !== 'undefined');
	});
	it("should have nothing registered in advance", function () {
		assert(IOC.getRegistrations().length == 0);
	});

	describe("with a registered module", function(){
		beforeEach(function(){
			IOC.register('testModule', stubModule);
		});

		it("should add that module to the list of registrations", function () {
			var registrations = IOC.getRegistrations();
			assert(registrations[0] === 'testModule');
		});
		it("should not have added a duplicate module (by name) to the registrations", function () {
			IOC.register('testModule', stubModule);
			var registrations = IOC.getRegistrations();
			assert(registrations.length === 1);
		});
		it("should be able to resolve the module", function () {
			var resolution = IOC.resolve('testModule');
			assert(typeof(resolution) === 'object');
		});
		it("should return the specific module requested", function () {
			assert(IOC.resolve('testModule').hello === 'world');
		});
	});
});<commit_msg>Added test for parameter dependency resolution.<commit_after>var assert = require('assert');
var IOC = require('../index');

var stubMessageProvider = { greeting: "Hello" };
var stubModule = {
	okay: true,
	test: function (name, messageProvider) {
		return messageProvider.greeting + " " + name;
	}
};

describe("The NoDice IOC object", function () {
	it("should exist globally", function () {
		assert(typeof(IOC) !== 'undefined');
	});
	it("should have nothing registered in advance", function () {
		assert(IOC.getRegistrations().length == 0);
	});

	describe("with a registered module", function(){
		beforeEach(function(){
			IOC.register('messageProvider', stubMessageProvider);
			IOC.register('testModule', stubModule);
		});

		it("should add that module to the list of registrations", function () {
			var registrations = IOC.getRegistrations();
			assert(registrations[1] === 'testModule');
		});
		it("should not have added a duplicate module (by name) to the registrations", function () {
			IOC.register('testModule', stubModule);
			var registrations = IOC.getRegistrations();
			assert(registrations.length === 2);
		});
		it("should be able to resolve the module", function () {
			var resolution = IOC.resolve('testModule');
			assert(typeof(resolution) === 'object');
		});
		it("should return the specific module requested", function () {
			assert(IOC.resolve('testModule').okay);
		});
		it("should inject dependencies into the module", function () {
			assert(IOC.resolve('testModule').test('Bob') === "Hello Bob");
		});
	});
});
{'fraction_non_alphanumeric': 0.1668484187568157, 'fraction_numerical': 0.0021810250817884407, 'mean_word_length': 4.85531914893617, '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': '4511794', 'n_tokens_mistral': 875, 'n_tokens_neox': 789, 'n_words': 217}