'use strict';

const path = require('path');
const assert = require('yeoman-assert');
const helpers = require('yeoman-test');

const proxyquire = require('proxyquire').noCallThru();
const simpleGitMock = require('./simple-git-mock');

const moduleBeingTested = '../generators/directive';

//
// Use 'simple-git' mock
//
proxyquire(moduleBeingTested, {'simple-git': simpleGitMock});

describe('generator-angular-modsmith:directive', () => {
  before(() => {
    return helpers.run(path.join(__dirname, '../generators/directive'))
      .withLocalConfig({
        pkg: {
          name: {
            orig: 'test-mod',
            slug: 'test-mod',
            camel: 'testMod'
          },
          desc: 'Test Module',
          version: '0.0.1',
          repo: '',
          license: 'Apache-2.0',
          keywords: [
            'key', 'word'
          ]
        },
        author: {
          name: 'Some One',
          email: 'some@one.two',
          url: ''
        }
      })
      .withPrompts({
        argName: 'alpha-beta',
        argExtTpl: true,
        argStyle: true,
        argLinkFn: true,
        argRestrict: 'E'
      })
      .toPromise();
  });

  it('Creates source file', () => {
    assert.file([
      'src/directives/alphaBeta/alphaBeta.directive.js'
    ]);
  });

  it('Creates external template', () => {
    assert.file([
      'src/directives/alphaBeta/alphaBeta.html'
    ]);
  });

  it('Creates stylus file', () => {
    assert.file([
      'src/directives/alphaBeta/alphaBeta.styl'
    ]);
  });

  it('Creates spec file', () => {
    assert.file([
      'src/directives/alphaBeta/alphaBeta.directive.spec.js'
    ]);
  });
});

@@ -1660,12 +1660,1468 @@
 ;%0A  %7D);%0A%7D);%0A
+%0Adescribe('generator-angular-modsmith:directive %5B2%5D', () =%3E %7B%0A  before(() =%3E %7B%0A    return helpers.run(path.join(__dirname, '../generators/directive'))%0A      .withLocalConfig(%7B%0A        pkg: %7B%0A          name: %7B%0A            orig: 'test-mod',%0A            slug: 'test-mod',%0A            camel: 'testMod'%0A          %7D,%0A          desc: 'Test Module',%0A          version: '0.0.1',%0A          repo: '',%0A          license: 'Apache-2.0',%0A          keywords: %5B%0A            'key', 'word'%0A          %5D%0A        %7D,%0A        author: %7B%0A          name: 'Some One',%0A          email: 'some@one.two',%0A          url: ''%0A        %7D%0A      %7D)%0A      .withPrompts(%7B%0A        argName: 'mu-pi',%0A        argExtTpl: false,%0A        argStyle: false,%0A        argLinkFn: false%0A      %7D)%0A      .toPromise();%0A  %7D);%0A%0A  it('Creates directive file', () =%3E %7B%0A    assert.file(%5B%0A      'src/directives/muPi/muPi.directive.js'%0A    %5D);%0A  %7D);%0A%0A  it('Creates inline template', () =%3E %7B%0A    assert.fileContent(%0A      'src/directives/muPi/muPi.directive.js',%0A      'template: %5C'%3Cdiv%3EDirective: muPi%3C/div%3E%5C''%0A    );%0A  %7D);%0A%0A  it('Doesn%5C't create external template', () =%3E %7B%0A    assert.noFile(%5B%0A      'src/directives/muPi/muPi.html'%0A    %5D);%0A  %7D);%0A%0A  it('Doesn%5C't create stylus file', () =%3E %7B%0A    assert.noFile(%5B%0A      'src/directives/muPi/muPi.styl'%0A    %5D);%0A  %7D);%0A%0A  it('Doesn%5C't set transclude', () =%3E %7B%0A    assert.noFileContent(%0A      'src/directives/muPi/muPi.directive.js',%0A      'transclude: true'%0A    );%0A  %7D);%0A%7D);%0A

Add test cases