<commit_before>const expect = require('chai').expect;
const fs = require('fs');
const path = require('path');
const pluginRunner = require('../lib/plugin_runner');

describe('goog.defineClass to ES6 class', () => {

  const convert = function(fileName) {
    const testFilePath = path.join(__dirname, fileName);
    // Add new line at the end to match the expected file.
    return pluginRunner.run(testFilePath);
  };

  const readFile = function(fileName) {
    return fs.readFileSync(path.join(__dirname, fileName), 'utf8');
  };

  it('converts file to es6', () => {
    expect(convert('with_statics_es5.js')).to.equal(
        readFile('with_statics_es6.js'));
  });

  it('converts file with parent', () => {
    expect(convert('inheritance_es5.js')).to.equal(
        readFile('inheritance_es6.js'));
  });

  it('converts statics', function() {
    expect(convert('static_functions_es5.js')).to.equal(
        readFile('static_functions_es6.js'));
  });
});<commit_msg>Add test to ensure files without goog.defineClass are skipped<commit_after>const expect = require('chai').expect;
const fs = require('fs');
const path = require('path');
const pluginRunner = require('../lib/plugin_runner');

describe('goog.defineClass to ES6 class', () => {

  const convert = function(fileName) {
    const testFilePath = path.join(__dirname, fileName);
    // Add new line at the end to match the expected file.
    return pluginRunner.run(testFilePath);
  };

  const readFile = function(fileName) {
    return fs.readFileSync(path.join(__dirname, fileName), 'utf8');
  };

  it('converts file to es6', () => {
    expect(convert('with_statics_es5.js')).to.equal(
        readFile('with_statics_es6.js'));
  });

  it('converts file with parent', () => {
    expect(convert('inheritance_es5.js')).to.equal(
        readFile('inheritance_es6.js'));
  });

  it('converts statics', function() {
    expect(convert('static_functions_es5.js')).to.equal(
        readFile('static_functions_es6.js'));
  });

  it('skips file without goog.defineClass', function() {
    // A file without goog.defineClass will be skipped.
    expect(convert('without_goog_define_class.js')).to.equal(
        readFile('without_goog_define_class.js'));
  });
});
{'fraction_non_alphanumeric': 0.16331096196868009, 'fraction_numerical': 0.008053691275167786, 'mean_word_length': 4.1639722863741335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1432495', 'n_tokens_mistral': 701, 'n_tokens_neox': 696, 'n_words': 142}