/*global describe, beforeEach, it*/
'use strict';
var path = require('path');
var helpers = require('yeoman-test');
var assert = require('yeoman-assert');

describe('mocha:app', function () {
  describe('defaults', function () {
    beforeEach(function (done) {
      helpers
        .run(path.join(__dirname, '../generators/app'))
        .on('end', done);
    });

    it('creates expected files', function () {
      assert.file([
        'test/spec/test.js',
        'test/index.html'
      ]);
      assert.fileContent('test/index.html', /mocha.setup\('bdd'\)/);
    });

    it('saves the options used', function () {
      assert.jsonFileContent('.yo-rc.json', {
        'generator-mocha': {
          ui: 'bdd',
          rjs: false
        }
      });
    });
  })

  describe('using options', function () {
    it('when --ui=bdd', function (done) {
      helpers
      .run(path.join(__dirname, '../generators/app'))
      .withOptions({ui: 'bdd'})
      .on('end', function () {
        assert.fileContent('test/index.html', /mocha.setup\('bdd'\)/);
        done()
      });
    });

    it('when --ui=tdd', function (done) {
      helpers
      .run(path.join(__dirname, '../generators/app'))
      .withOptions({ui: 'tdd'})
      .on('end', function () {
        assert.fileContent('test/index.html', /mocha.setup\('tdd'\)/);
        done();
      });
    });
  });

  describe('using prompts', function () {
    it('when --ui=bdd', function (done) {
      helpers
      .run(path.join(__dirname, '../generators/app'))
      .withPrompts({ui: 'bdd'})
      .on('end', function () {
        assert.fileContent('test/index.html', /mocha.setup\('bdd'\)/);
        done()
      });
    });

    it('when --ui=tdd', function (done) {
      helpers
      .run(path.join(__dirname, '../generators/app'))
      .withPrompts({ui: 'tdd'})
      .on('end', function () {
        assert.fileContent('test/index.html', /mocha.setup\('tdd'\)/);
        done();
      });
    });
  });
});

@@ -43,19 +43,21 @@
 trict';%0A
-var
+const
  path = 
@@ -73,19 +73,21 @@
 path');%0A
-var
+const
  helpers
@@ -117,11 +117,13 @@
 ');%0A
-var
+const
  ass
@@ -177,27 +177,21 @@
 a:app', 
-function ()
+() =%3E
  %7B%0A  des
@@ -204,35 +204,29 @@
 'defaults', 
-function ()
+() =%3E
  %7B%0A    befor
@@ -234,24 +234,16 @@
 Each
-(function 
 (done
-)
+ =%3E
  %7B%0A 
@@ -375,35 +375,29 @@
 ted files', 
-function ()
+() =%3E
  %7B%0A      ass
@@ -579,35 +579,29 @@
 ions used', 
-function ()
+() =%3E
  %7B%0A      ass
@@ -766,35 +766,29 @@
 g options', 
-function ()
+() =%3E
  %7B%0A    it('w
@@ -798,39 +798,31 @@
  --ui=bdd', 
-function (
 done
-)
+ =%3E
  %7B%0A      hel
@@ -925,35 +925,29 @@
  .on('end', 
-function ()
+() =%3E
  %7B%0A        a
@@ -1062,39 +1062,31 @@
  --ui=tdd', 
-function (
 done
-)
+ =%3E
  %7B%0A      hel
@@ -1189,35 +1189,29 @@
  .on('end', 
-function ()
+() =%3E
  %7B%0A        a
@@ -1341,27 +1341,21 @@
 ompts', 
-function ()
+() =%3E
  %7B%0A    i
@@ -1369,39 +1369,31 @@
  --ui=bdd', 
-function (
 done
-)
+ =%3E
  %7B%0A      hel
@@ -1496,35 +1496,29 @@
  .on('end', 
-function ()
+() =%3E
  %7B%0A        a
@@ -1641,23 +1641,15 @@
 d', 
-function (
 done
-)
+ =%3E
  %7B%0A 
@@ -1768,19 +1768,13 @@
 d', 
-function ()
+() =%3E
  %7B%0A 

Update tests to ES6 syntax