// Load in dependencies
var fs = require('fs');
var esformatter = require('esformatter');
var esformatterPhonetic = require('../');

// Register our plugin
esformatter.register(esformatterPhonetic);

// Define test utilities
var testUtils = {
  format: function (filepath) {
    before(function formatFn () {
      // Format our content
      var input = fs.readFileSync(filepath, 'utf8');
      this.output = esformatter.format(input, {
        phonetic: {
          baseSeed: 1337
        }
      });

      // If we are in a debug environment, write the output to disk
      if (process.env.TEST_DEBUG) {
        try {
          fs.mkdirSync(__dirname + '/actual-files/');
        } catch (err) {
          // Ignore error (prob caused by directory existing)
        }
        var debugFilepath = filepath.replace('test-files/', 'actual-files/');
        fs.writeFileSync(debugFilepath, this.output);
      }
    });
    after(function cleanup () {
      // Cleanup output
      delete this.output;
    });
  }
};

// Start our tests
describe('esformatter-phonetic', function () {
  describe('formatting a JS file with single variable definitions', function () {
    testUtils.format(__dirname + '/test-files/single-variables.js');

    it('updates the names', function () {
      // TODO: Generate a seed and stick to it
      console.log('');
      console.log(this.output);
    });
  });
});

@@ -13,24 +13,56 @@
 ependencies%0A
+var assert = require('assert');%0A
 var fs = req
@@ -1313,96 +1313,152 @@
     
-// TODO: Generate a seed and stick to it%0A      console.log('');%0A      console.log(this.o
+var expectedOutput = fs.readFileSync(__dirname + '/expected-files/single-variables.js', 'utf8');%0A      assert.strictEqual(this.output, expectedO
 utpu

First test is green, aww yeaaah