<commit_before>'use strict';

var assert = require('assert');
const {escap} = require('../escapejs');


describe('Testing of the recursive escape', function(){

	it('send string must return string', function(){
		var str = "<string>";
		var resStr = "%3Cstring%3E";
		assert.equal(resStr, escap(str), 'Testing String');
	});

	it('send json must return json', function(){
		var obj = {
			'a': '<script>',
			'b': ['a', '<script>', {'a': 1, 'b': '<script>'}]
		};
		var json = { a: '%3Cscript%3E', b: [ 'a', '%3Cscript%3E', { a: 1, b: '%3Cscript%3E' } ] };
		assert.deepEqual(json, escap(obj), 'Testing JSON');
	});
    
	it('send array must return array', function(){
		var arr = [
			'<script>', 
			['asdasd', '<script>', 
				['<asdasd>', 
					['a', '<script>', {'a': '12', 'b': '<script>'}]
				]
			]
		];
		var array = [ '%3Cscript%3E', [ 'asdasd', '%3Cscript%3E', [ '%3Casdasd%3E', [Object] ] ] ];
		assert.notStrictEqual(array, escap(arr), 'Testing Array');
	});
});<commit_msg>[*] running test before comparable version<commit_after>var versions = process.versions.node;
var numVersion = parseInt(versions.replace('.', ''));

if(versions === '6.4.0' || numVersion >= 64){
	require('./tests_es6');
}else{
	require('./tests_es5');
}
{'fraction_non_alphanumeric': 0.2465753424657534, 'fraction_numerical': 0.020145044319097503, 'mean_word_length': 4.330472103004292, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 13, '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': '177456', 'n_tokens_mistral': 491, 'n_tokens_neox': 450, 'n_words': 109}