<commit_before>define([
	'intern!object',
	'intern/chai!assert',
	'../../../../stores/util/simpleQueryEngine'
], function (registerSuite, assert, simpleQueryEngine) {
	var data;

	registerSuite({
		name: 'core/stores/util/simpleQueryEngine',
		beforeEach: function () {
			data = [
				{ id: 1, even: false, name: 'one', other: 6 },
				{ id: 2, even: true, name: 'two', other: 2 },
				{ id: 3, even: false, name: 'three', other: 1 },
				{ id: 4, even: true, name: 'four', other: 5 },
				{ id: 5, even: false, name: 'five', other: 4 },
				{ id: 6, even: true, name: 'six', other: 3 }
			];
		},
		'object query': function () {
			var query = simpleQueryEngine({ even: true }),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
		},
		'object query test': function () {
			var query = simpleQueryEngine({ name: { test: function (value) { return !!~value.indexOf('o'); } } }),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 1);
		},
		'function query test': function () {
			var query = simpleQueryEngine(function (value) {
					return value && value.even;
				}),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
		},
		'string query test': function () {
			var query = simpleQueryEngine.call({ matches: function (value) {
					return value && !value.even;
				} }, 'matches'),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 1);
		},
		'query all': function () {
			var query = simpleQueryEngine(),
				results = query(data);
			assert.equal(results.length, 6);
			assert.equal(results[5].id, 6);
		},
		'does throw': function () {
			assert.throws(function () {
				simpleQueryEngine(99);
			});
		},
		'sorting function': function () {
			var query = simpleQueryEngine({ even: true }, { sort: function (a, b) {
					return a.other > b.other;
				}}),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
			assert.equal(results[1].id, 6);
		},
		'sorting object': function () {
			var query = simpleQueryEngine({ even: true }, { sort: [ { attribute: 'other' } ] }),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
			assert.equal(results[1].id, 6);
		},
		'sorting object descending': function () {
			var query = simpleQueryEngine({ even: true }, { sort: [ { attribute: 'other', descending: true } ] }),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 4);
			assert.equal(results[1].id, 6);
		},
		'paging - start': function () {
			var query = simpleQueryEngine(undefined, { start: 1 }),
				results = query(data);
			assert.equal(results.total, 6);
			assert.equal(results.length, 5);
			assert.equal(results[0].id, 2);
		},
		'paging - count': function () {
			var query = simpleQueryEngine(undefined, { count: 3 }),
				results = query(data);
			assert.equal(results.total, 6);
			assert.equal(results.length, 3);
			assert.equal(results[2].id, 3);
		},
		'paging - start and count': function () {
			var query = simpleQueryEngine(undefined, { start: 1, count: 3 }),
				results = query(data);
			assert.equal(results.total, 6);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
		}
	});
});<commit_msg>Fix issue with tests for core/stores/util/simpleQueryEngine<commit_after>define([
	'intern!object',
	'intern/chai!assert',
	'../../../../stores/util/simpleQueryEngine'
], function (registerSuite, assert, simpleQueryEngine) {
	var data;

	registerSuite({
		name: 'core/stores/util/simpleQueryEngine',
		beforeEach: function () {
			data = [
				{ id: 1, even: false, name: 'one', other: 6 },
				{ id: 2, even: true, name: 'two', other: 2 },
				{ id: 3, even: false, name: 'three', other: 1 },
				{ id: 4, even: true, name: 'four', other: 5 },
				{ id: 5, even: false, name: 'five', other: 4 },
				{ id: 6, even: true, name: 'six', other: 3 }
			];
		},
		'object query': function () {
			var query = simpleQueryEngine({ even: true }),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
		},
		'object query test': function () {
			var query = simpleQueryEngine({ name: { test: function (value) { return !!~value.indexOf('o'); } } }),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 1);
		},
		'function query test': function () {
			var query = simpleQueryEngine(function (value) {
					return value && value.even;
				}),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
		},
		'string query test': function () {
			var query = simpleQueryEngine.call({ matches: function (value) {
					return value && !value.even;
				} }, 'matches'),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 1);
		},
		'query all': function () {
			var query = simpleQueryEngine(),
				results = query(data);
			assert.equal(results.length, 6);
			assert.equal(results[5].id, 6);
		},
		'does throw': function () {
			assert.throws(function () {
				simpleQueryEngine(99);
			});
		},
		'sorting function': function () {
			var query = simpleQueryEngine({ even: true }, { sort: function (a, b) {
					return a.other > b.other ? 1 : a === b ? 0 : -1;
				}}),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
			console.log(results);
			assert.equal(results[1].id, 6);
		},
		'sorting object': function () {
			var query = simpleQueryEngine({ even: true }, { sort: [ { attribute: 'other' } ] }),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
			assert.equal(results[1].id, 6);
		},
		'sorting object descending': function () {
			var query = simpleQueryEngine({ even: true }, { sort: [ { attribute: 'other', descending: true } ] }),
				results = query(data);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 4);
			assert.equal(results[1].id, 6);
		},
		'paging - start': function () {
			var query = simpleQueryEngine(undefined, { start: 1 }),
				results = query(data);
			assert.equal(results.total, 6);
			assert.equal(results.length, 5);
			assert.equal(results[0].id, 2);
		},
		'paging - count': function () {
			var query = simpleQueryEngine(undefined, { count: 3 }),
				results = query(data);
			assert.equal(results.total, 6);
			assert.equal(results.length, 3);
			assert.equal(results[2].id, 3);
		},
		'paging - start and count': function () {
			var query = simpleQueryEngine(undefined, { start: 1, count: 3 }),
				results = query(data);
			assert.equal(results.total, 6);
			assert.equal(results.length, 3);
			assert.equal(results[0].id, 2);
		}
	});
});
{'fraction_non_alphanumeric': 0.18766481101670085, 'fraction_numerical': 0.018019337825959568, 'mean_word_length': 3.4016763378465504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3510213', 'n_tokens_mistral': 2740, 'n_tokens_neox': 2273, 'n_words': 545}