<commit_before>(function(buster, createContext) {
"use strict";

var assert, refute, fail;

assert = buster.assert;
refute = buster.refute;
fail = buster.assertions.fail;

buster.testCase('context', {

	'initializers': {
		'should execute when context is created': function(done) {
			var executed = false;
			createContext({}, null, {
				require: require,
				init: function() { executed = true; }
			}).then(
				function() {
					assert(executed);
				}
			).then(done, done);
		}
	},

	'destroyers': {
		'should execute when context is destroyed': function(done) {
			var executed = false;
			createContext({}, null, {
				require: require,
				destroy: function() { executed = true; }
			}).then(
				function(context) {
					refute(executed);

					context.destroy().then(
						function() {
							assert(executed);
						}
					);
				}
			).then(done, done);
		}
	},

	'initializers and destroyers': {
		'should execute in correct order': function(done) {
		var init, destroy;
			createContext({}, null, {
				require: require,
				init: function() {
					refute(init);
					refute(destroy);
					init = true;
				},
				destroy: function() {
					assert(init);
					refute(destroy);
					destroy = true;
				}
			}).then(
				function(context) {
					// Should not have executed yet
					refute(destroy);

					return context.destroy().then(
						function() {
							assert(init);
							assert(destroy);
						}
					);
				}
			).then(done, done);
		}
	}
});

})(
	require('buster'),
	require('../../lib/context')
);<commit_msg>Slight simplification to initializer/destroyer unit tests<commit_after>(function(buster, createContext) {
"use strict";

var assert, refute, fail;

assert = buster.assert;
refute = buster.refute;
fail = buster.assertions.fail;

buster.testCase('context', {

	'initializers': {
		'should execute when context is created': function(done) {
			var executed = false;
			createContext({}, null, {
				require: require,
				init: function() { executed = true; }
			}).then(
				function() {
					assert(executed);
				}
			).then(done, done);
		}
	},

	'destroyers': {
		'should execute when context is destroyed': function(done) {
			var executed = false;
			createContext({}, null, {
				require: require,
				destroy: function() { executed = true; }
			}).then(
				function(context) {
					refute(executed);

					context.destroy().then(
						function() {
							assert(executed);
						}
					);
				}
			).then(done, done);
		}
	},

	'initializers and destroyers': {
		'should execute in correct order': function(done) {
		var init, destroy;
			createContext({}, null, {
				require: require,
				init: function() {
					refute(init);
					refute(destroy);
					init = true;
				},
				destroy: function() {
					assert(init);
					refute(destroy);
					destroy = true;
				}
			}).then(
				function(context) {
					// Should not have executed yet
					refute(destroy);

					return context.destroy().then(
						function() {
							assert(destroy);
						}
					);
				}
			).then(done, done);
		}
	}
});

})(
	require('buster'),
	require('../../lib/context')
);
{'fraction_non_alphanumeric': 0.15835210814290313, 'fraction_numerical': 0.0, 'mean_word_length': 2.67810650887574, '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': '769948', 'n_tokens_mistral': 1326, 'n_tokens_neox': 991, 'n_words': 226}