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

describe('JSON', function(){
	
	it('should catch missing closing brackets', function(){
		validate.JSON('{', function (errors) {
			assert(errors && errors.length > 0);
		});
	});

	it('should have key/value pair for "repetition_time"', function(){
		var jsonObj = '{"repetition_time": 0.5, "echo_time": 0.005, "flip_angle": 90}';
		validate.JSON(jsonObj, function (errors) {
			assert(errors == null);
		});
		var jsonObjInval = '{"echo_time": 0.005, "flip_angle": 90}';
		validate.JSON(jsonObjInval, function (errors) {
			assert(errors && errors.length === 1);
		});
		var jsonObjSpell = '{"repitition_time": 0.5, "echo_time": 0.005, "flip_angle": 90}';
		validate.JSON(jsonObjSpell, function (errors) {
			assert(errors && errors.length === 1);
		});
	});

});<commit_msg>updated JSON tests to account for sidecar boolean<commit_after>var assert   = require('assert');
var validate = require('../index');

describe('JSON', function(){
	
	it('should catch missing closing brackets', function(){
		validate.JSON('{', false, function (errors) {
			assert(errors && errors.length > 0);
		});
	});

	it('sidecars should have key/value pair for "RepetitionTime"', function(){
		var jsonObj = '{"RepetitionTime": 0.5, "echo_time": 0.005, "flip_angle": 90}';
		validate.JSON(jsonObj, true, function (errors) {
			assert(errors == null);
		});
		var jsonObjInval = '{"echo_time": 0.005, "flip_angle": 90}';
		validate.JSON(jsonObjInval, true, function (errors) {
			assert(errors && errors.length === 1);
		});
		var jsonObjSpell = '{"RepititionTime": 0.5, "echo_time": 0.005, "flip_angle": 90}';
		validate.JSON(jsonObjSpell, true, function (errors) {
			assert(errors && errors.length === 1);
		});
	});

});
{'fraction_non_alphanumeric': 0.19430485762144054, 'fraction_numerical': 0.027917364600781685, 'mean_word_length': 4.762057877813505, 'pattern_counts': {'":': 16, '<': 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': '1503873', 'n_tokens_mistral': 685, 'n_tokens_neox': 587, 'n_words': 144}