<commit_before>"use strict";

import Plugin from '../src'
import fs from 'fs'
import assert from 'assert'
import { transformFileSync } from 'babel-core'

function test(name, dir, externalHelpers) {
	it("should compile " + name, function () {
		var actual = transformFileSync("./test/fixtures/" + dir + "/actual.js", {
			plugins: [require('../src/index')],
			blacklist: ['es6.destructuring'],
			externalHelpers: externalHelpers
		}).code;
		var expected = fs.readFileSync("./test/fixtures/" + dir + "/expected.js", "utf8").toString();
		assert.equal(actual, expected);
	});
}

describe("extensible-destructuring", () => {

	test("basic object destructuring", "object-basic", false);
	test("custom object destructuring with string keys", "object-custom", false);
	test("custom object destructuring with non-string keys", "object-non-string-key", false);
	test("custom object destructuring of the book example", "book-example", false);
	test("multiple destructurings", "multiple", false);
	test("destructuring in for-in", "for-in", true);
	test("destructuring of parameters", "parameters", true);
});
<commit_msg>Modernizing tests code, take 2<commit_after>"use strict";

import Plugin from '../src'
import fs from 'fs'
import assert from 'assert'
import { transformFileSync } from 'babel-core'

function test(name, dir, externalHelpers) {
	it("should compile " + name, function () {
		var actual = transformFileSync("./test/fixtures/" + dir + "/actual.js", {
			plugins: [Plugin],
			blacklist: ['es6.destructuring'],
			externalHelpers: externalHelpers
		}).code;
		var expected = fs.readFileSync("./test/fixtures/" + dir + "/expected.js", "utf8").toString();
		assert.equal(actual, expected);
	});
}

describe("extensible-destructuring", () => {

	test("basic object destructuring", "object-basic", false);
	test("custom object destructuring with string keys", "object-custom", false);
	test("custom object destructuring with non-string keys", "object-non-string-key", false);
	test("custom object destructuring of the book example", "book-example", false);
	test("multiple destructurings", "multiple", false);
	test("destructuring in for-in", "for-in", true);
	test("destructuring of parameters", "parameters", true);
});

{'fraction_non_alphanumeric': 0.16756513926325248, 'fraction_numerical': 0.0022461814914645105, 'mean_word_length': 5.308781869688385, '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': '3654404', 'n_tokens_mistral': 683, 'n_tokens_neox': 648, 'n_words': 186}