<commit_before>define([
	'intern!object',
	'intern/chai!assert',
	'dojo/_base/declare',
	'./sorting',
	'dstore/Memory',
	'dstore/QueryMethod'
], function (registerSuite, assert, declare, sorting, Memory, QueryMethod) {

	var store;
	var Model = declare(null, {
		constructor: function (args) {
			declare.safeMixin(this, args);
		}
	});

	registerSuite({
		name: 'dstore Memory',

		beforeEach: function () {
			store = new Memory({
				data: [
					{ id: 1, name: 'one', prime: false, mappedTo: 'E' },
					{ id: 2, name: 'two', even: true, prime: true, mappedTo: 'D' },
					{ id: 3, name: 'three', prime: true, mappedTo: 'C' },
					{ id: 4, name: 'four', even: true, prime: false, mappedTo: null },
					{ id: 5, name: 'five', prime: true, mappedTo: 'A' }
				],
				Model: Model,
				filterFunction: function (object) {
					return object.name === 'two';
				}
			});

			// add a method to the model prototype
			store.Model.prototype.describe = function () {
				return this.name + ' is ' + (this.prime ? '' : 'not ') + 'a prime';
			};
		},

		'getSync': function () {
			assert.strictEqual(store.getSync(1).name, 'one');
			assert.strictEqual(store.getSync(4).name, 'four');
			assert.isTrue(store.getSync(5).prime);
		},
		'get': function () {
			return store.get(1).then(function (object) {
				assert.strictEqual(object.name, 'one');
			});
		},

		'Model': function () {
			assert.strictEqual(store.getSync(1).describe(), 'one is not a prime');
			assert.strictEqual(store.getSync(3).describe(), 'three is a prime');<commit_msg>Add test for synchronous totalLength from Memory<commit_after>define([
	'intern!object',
	'intern/chai!assert',
	'dojo/_base/declare',
	'./sorting',
	'dstore/Memory',
	'dstore/QueryMethod'
], function (registerSuite, assert, declare, sorting, Memory, QueryMethod) {

	var store;
	var Model = declare(null, {
		constructor: function (args) {
			declare.safeMixin(this, args);
		}
	});

	registerSuite({
		name: 'dstore Memory',

		beforeEach: function () {
			store = new Memory({
				data: [
					{ id: 1, name: 'one', prime: false, mappedTo: 'E' },
					{ id: 2, name: 'two', even: true, prime: true, mappedTo: 'D' },
					{ id: 3, name: 'three', prime: true, mappedTo: 'C' },
					{ id: 4, name: 'four', even: true, prime: false, mappedTo: null },
					{ id: 5, name: 'five', prime: true, mappedTo: 'A' }
				],
				Model: Model,
				filterFunction: function (object) {
					return object.name === 'two';
				}
			});

			// add a method to the model prototype
			store.Model.prototype.describe = function () {
				return this.name + ' is ' + (this.prime ? '' : 'not ') + 'a prime';
			};
		},

		'getSync': function () {
			assert.strictEqual(store.getSync(1).name, 'one');
			assert.strictEqual(store.getSync(4).name, 'four');
			assert.isTrue(store.getSync(5).prime);
		},
		'get': function () {
			return store.get(1).then(function (object) {
				assert.strictEqual(object.name, 'one');
			});
		},

		'fetchSync and fetchRangeSync results.totalLength': function () {
			var results = store.fetchSync(),
				rangeResults = store.fetchRangeSync({ start: 0, end: 1 });

			assert.isNumber(results.totalLength);
			assert.isNumber(rangeResults.totalLength);

			assert(results.totalLength, results.length);
			assert.strictEqual(rangeResults.totalLength, results.totalLength);
		},

		'Model': function () {
			assert.strictEqual(store.getSync(1).describe(), 'one is not a prime');
			assert.strictEqual(store.getSync(3).describe(), 'three is a prime');
{'fraction_non_alphanumeric': 0.18044037746639977, 'fraction_numerical': 0.006863025450386045, 'mean_word_length': 3.5725490196078433, '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': '4069812', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1168, 'n_words': 283}