forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-class.spec.js
46 lines (38 loc) · 1.42 KB
/
generate-class.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
const ng = require('../helpers/ng');
const tmp = require('../helpers/tmp');
const existsSync = require('exists-sync');
const expect = require('chai').expect;
const path = require('path');
const root = process.cwd();
const testPath = path.join(root, 'tmp', 'foo', 'src', 'app');
describe('Acceptance: ng generate class', function () {
beforeEach(function () {
this.timeout(10000);
return tmp.setup('./tmp').then(function () {
process.chdir('./tmp');
}).then(function () {
return ng(['new', 'foo', '--skip-npm']);
});
});
afterEach(function () {
return tmp.teardown('./tmp');
});
it('ng generate class my-class', function () {
return ng(['generate', 'class', 'my-class']).then(() => {
expect(existsSync(path.join(testPath, 'my-class.ts'))).to.equal(true);
expect(existsSync(path.join(testPath, 'my-class.spec.ts'))).to.equal(false);
});
});
it('ng generate class my-class --no-spec', function () {
return ng(['generate', 'class', 'my-class', '--no-spec']).then(() => {
expect(existsSync(path.join(testPath, 'my-class.ts'))).to.equal(true);
expect(existsSync(path.join(testPath, 'my-class.spec.ts'))).to.equal(false);
});
});
it('ng generate class my-class.model', function () {
return ng(['generate', 'class', 'my-class.model']).then(() => {
expect(existsSync(path.join(testPath, 'my-class.model.ts'))).to.equal(true);
});
});
});