1 |
|
2 | 'use strict';
|
3 | var path = require('path');
|
4 | var assert = require('yeoman-assert');
|
5 | var helpers = require('yeoman-generator').test;
|
6 |
|
7 | describe('license:app', function () {
|
8 | before(function (done) {
|
9 | helpers.run(path.join(__dirname, '../app'))
|
10 | .withPrompts({
|
11 | name: 'Rick',
|
12 | email: 'foo@example.com',
|
13 | website: 'http://example.com',
|
14 | license: 'MIT'
|
15 | })
|
16 | .on('end', done);
|
17 | });
|
18 |
|
19 | it('creates LICENSE file', function () {
|
20 | assert.file('LICENSE');
|
21 | });
|
22 | it('creates package.json file', function () {
|
23 | assert.file('package.json');
|
24 | });
|
25 | });
|
26 |
|
27 | describe('license:app with options', function () {
|
28 | before(function (done) {
|
29 | helpers.run(path.join(__dirname, '../app'))
|
30 | .withPrompts({
|
31 | license: 'ISC'
|
32 | })
|
33 | .withOptions({
|
34 | name: 'Rick',
|
35 | email: 'foo@example.com',
|
36 | website: 'http://example.com'
|
37 | })
|
38 | .on('end', done);
|
39 | });
|
40 |
|
41 | it('creates LICENSE file', function () {
|
42 | assert.fileContent('LICENSE', 'ISC');
|
43 | assert.fileContent('LICENSE', 'Rick <foo@example.com> (http://example.com)');
|
44 | assert.fileContent('package.json', '"license": "ISC"');
|
45 | });
|
46 | });
|
47 |
|
48 | describe('license:app with nolicense', function () {
|
49 | before(function (done) {
|
50 | helpers.run(path.join(__dirname, '../app'))
|
51 | .withPrompts({
|
52 | name: 'Rick',
|
53 | email: 'foo@example.com',
|
54 | website: 'http://example.com',
|
55 | license: 'nolicense'
|
56 | })
|
57 | .on('end', done);
|
58 | });
|
59 |
|
60 | it('makes npm module private', function () {
|
61 | assert.noFileContent('package.json', '"license"');
|
62 | assert.fileContent('package.json', '"private": true');
|
63 | });
|
64 | });
|