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 - generate Apache 2.0 license', 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: 'Apache-2.0',
|
15 | year: '2015'
|
16 | })
|
17 | .on('end', done);
|
18 | });
|
19 |
|
20 | it('creates LICENSE file using Apache 2.0 template', function () {
|
21 | assert.fileContent('LICENSE', 'Apache License, Version 2.0');
|
22 | assert.fileContent('LICENSE', 'Copyright 2015 Rick <foo@example.com> (http://example.com)');
|
23 | });
|
24 | it('creates package.json file with Apache 2.0 license', function () {
|
25 | assert.fileContent('package.json', '"license": "Apache-2.0"');
|
26 | });
|
27 | });
|
28 |
|
29 | describe('license:app - generate BSD 2 license', function () {
|
30 | before(function (done) {
|
31 | helpers.run(path.join(__dirname, '../app'))
|
32 | .withPrompts({
|
33 | name: 'Rick',
|
34 | email: 'foo@example.com',
|
35 | website: 'http://example.com',
|
36 | license: 'BSD-2-Clause-FreeBSD',
|
37 | year: '2015'
|
38 | })
|
39 | .on('end', done);
|
40 | });
|
41 |
|
42 | it('creates LICENSE file using BSD 2 template', function () {
|
43 | assert.fileContent('LICENSE', 'FreeBSD Project');
|
44 | assert.fileContent('LICENSE', 'Copyright (c) 2015, Rick <foo@example.com> (http://example.com)');
|
45 | });
|
46 | it('creates package.json file with BSD 2 license', function () {
|
47 | assert.fileContent('package.json', '"license": "BSD-2-Clause-FreeBSD"');
|
48 | });
|
49 | });
|
50 |
|
51 | describe('license:app - generate BSD 3 license', function () {
|
52 | before(function (done) {
|
53 | helpers.run(path.join(__dirname, '../app'))
|
54 | .withPrompts({
|
55 | name: 'Rick',
|
56 | email: 'foo@example.com',
|
57 | website: 'http://example.com',
|
58 | license: 'BSD-3-Clause',
|
59 | year: '2015'
|
60 | })
|
61 | .on('end', done);
|
62 | });
|
63 |
|
64 | it('creates LICENSE file using BSD 3 template', function () {
|
65 | assert.fileContent('LICENSE', 'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"');
|
66 | assert.fileContent('LICENSE', 'Copyright (c) 2015, Rick <foo@example.com> (http://example.com)');
|
67 | });
|
68 | it('creates package.json file with BSD 3 license', function () {
|
69 | assert.fileContent('package.json', '"license": "BSD-3-Clause"');
|
70 | });
|
71 | });
|
72 |
|
73 | describe('license:app - generate ISC license', function () {
|
74 | before(function (done) {
|
75 | helpers.run(path.join(__dirname, '../app'))
|
76 | .withPrompts({
|
77 | name: 'Rick',
|
78 | email: 'foo@example.com',
|
79 | website: 'http://example.com',
|
80 | license: 'ISC',
|
81 | year: '2015'
|
82 | })
|
83 | .on('end', done);
|
84 | });
|
85 |
|
86 | it('creates LICENSE file using ISC template', function () {
|
87 | assert.fileContent('LICENSE', 'THE SOFTWARE IS PROVIDED "AS IS"');
|
88 | assert.fileContent('LICENSE', 'Copyright (c) 2015 Rick <foo@example.com> (http://example.com)');
|
89 | });
|
90 | it('creates package.json file with ISC license', function () {
|
91 | assert.fileContent('package.json', '"license": "ISC"');
|
92 | });
|
93 | });
|
94 |
|
95 | describe('license:app - generate MIT license', function () {
|
96 | before(function (done) {
|
97 | helpers.run(path.join(__dirname, '../app'))
|
98 | .withPrompts({
|
99 | name: 'Rick',
|
100 | email: 'foo@example.com',
|
101 | website: 'http://example.com',
|
102 | license: 'MIT',
|
103 | year: '2015'
|
104 | })
|
105 | .on('end', done);
|
106 | });
|
107 |
|
108 | it('creates LICENSE file using MIT template', function () {
|
109 | assert.fileContent('LICENSE', 'The MIT License (MIT)');
|
110 | assert.fileContent('LICENSE', 'Copyright (c) 2015 Rick <foo@example.com> (http://example.com)');
|
111 | });
|
112 | it('creates package.json file with MIT license', function () {
|
113 | assert.fileContent('package.json', '"license": "MIT"');
|
114 | });
|
115 | });
|
116 |
|
117 | describe('license:app - generate copyrighted license', function () {
|
118 | before(function (done) {
|
119 | helpers.run(path.join(__dirname, '../app'))
|
120 | .withPrompts({
|
121 | name: 'Rick',
|
122 | email: 'foo@example.com',
|
123 | website: 'http://example.com',
|
124 | license: 'nolicense',
|
125 | year: '2015'
|
126 | })
|
127 | .on('end', done);
|
128 | });
|
129 |
|
130 | it('creates LICENSE file using nolicense template', function () {
|
131 | assert.fileContent('LICENSE', 'Copyright (c) 2015 Rick <foo@example.com> (http://example.com)');
|
132 | });
|
133 | it('creates package.json file with no license', function () {
|
134 | assert.noFileContent('package.json', '"license"');
|
135 | assert.fileContent('package.json', '"private": true');
|
136 | });
|
137 | });
|
138 |
|
139 | describe('license:app - generate unlicense license', function () {
|
140 | before(function (done) {
|
141 | helpers.run(path.join(__dirname, '../app'))
|
142 | .withPrompts({
|
143 | name: 'Rick',
|
144 | email: 'foo@example.com',
|
145 | website: 'http://example.com',
|
146 | license: 'unlicense',
|
147 | year: '2015'
|
148 | })
|
149 | .on('end', done);
|
150 | });
|
151 |
|
152 | it('creates LICENSE file using unlicense template', function () {
|
153 | assert.fileContent('LICENSE', 'This is free and unencumbered software released into the public domain.');
|
154 | });
|
155 | it('creates package.json file with unlicense license', function () {
|
156 | assert.fileContent('package.json', '"license": "unlicense"');
|
157 | });
|
158 | });
|