UNPKG

generator-zo

Version:
93 lines (83 loc) 2.28 kB
/*global describe, beforeEach, it*/ 'use strict'; var path = require('path'); var helpers = require('yeoman-test'); var assert = require('yeoman-assert'); describe('nodejs generator', function () { var tempPath = path.join(__dirname, '..', 'temp'); beforeEach(function (done) { helpers.testDirectory(tempPath, function (err) { if (err) { return done(err); } this.app = helpers.createGenerator('nodejs:app', [ '../app' ], [], { 'skip-install': true }); done(); }.bind(this)); }); it('creates expected files', function (done) { var expected = [ 'index.js', 'test/index.js', '.gitignore', '.jshintrc', '.travis.yml', ['package.json', /"name": "mymodule"/], ['Gruntfile.js', /!node_modules/], 'README.md', 'LICENSE' ]; helpers.mockPrompt(this.app, { 'moduleName': 'mymodule', 'moduleDesc': 'awesome module', 'keywords': 'something', 'useGrunt': true, 'testFramework': 'mocha', 'assertionLibrary': 'expect.js', 'githubName': 'octocat', 'author': 'Octo Cat <main@mail.com>' }); this.app.run(function () { expected.forEach(function (file) { if (typeof file === 'string') { assert.file(file); } else if (Array.isArray(file)) { assert.fileContent(file[0], file[1]); } }); done(); }); }); it('creates minimal tape files', function (done) { var expected = [ 'index.js', 'test/index.js', '.gitignore', '.travis.yml', ['package.json', /"name": "mymodule"/], 'README.md', 'LICENSE' ]; helpers.mockPrompt(this.app, { 'moduleName': 'mymodule', 'moduleDesc': 'awesome module', 'keywords': 'something', 'useGrunt': false, 'testFramework': 'tape', 'assertionLibrary': 'none', 'githubName': 'octocat', 'author': 'Octo Cat <main@mail.com>' }); this.app.run(function () { expected.forEach(function (file) { if (typeof file === 'string') { assert.file(file); } else if (Array.isArray(file)) { assert.fileContent(file[0], file[1]); } }); done(); }); }); });