Skip to content

Commit f3c3b9a

Browse files
committed
test: update e2e tests
1 parent ca4a510 commit f3c3b9a

File tree

7 files changed

+25
-20
lines changed

7 files changed

+25
-20
lines changed

tests/acceptance/generate-component.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ describe('Acceptance: ng generate component', function () {
133133
});
134134

135135
it('ng generate component ..' + path.sep + 'my-comp from root dir will fail', () => {
136-
return ng(['generate', 'component', '..' + path.sep + 'my-comp']).then(() => {
136+
return ng(['generate', 'component', '..' + path.sep + 'my-comp']).catch(() => {
137137
var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-comp', 'my-comp.component.ts');
138138
expect(existsSync(testPath)).to.equal(false);
139139
});

tests/acceptance/generate-directive.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ describe('Acceptance: ng generate directive', function () {
143143
});
144144

145145
it('ng generate directive ..' + path.sep + 'my-dir from root dir will fail', () => {
146-
return ng(['generate', 'directive', '..' + path.sep + 'my-dir']).then(() => {
146+
return ng(['generate', 'directive', '..' + path.sep + 'my-dir']).catch(() => {
147147
var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-dir', 'my-dir.directive.ts');
148148
expect(existsSync(testPath)).to.equal(false);
149149
});

tests/acceptance/generate-pipe.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe('Acceptance: ng generate pipe', function () {
132132
});
133133

134134
it('ng generate pipe ..' + path.sep + 'my-pipe from root dir will fail', () => {
135-
return ng(['generate', 'pipe', '..' + path.sep + 'my-pipe']).then(() => {
135+
return ng(['generate', 'pipe', '..' + path.sep + 'my-pipe']).catch(() => {
136136
var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-pipe.pipe.ts');
137137
expect(existsSync(testPath)).to.equal(false);
138138
});

tests/acceptance/generate-service.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe('Acceptance: ng generate service', function () {
135135
});
136136

137137
it('ng generate service ..' + path.sep + 'my-svc from root dir will fail', () => {
138-
return ng(['generate', 'service', '..' + path.sep + 'my-svc']).then(() => {
138+
return ng(['generate', 'service', '..' + path.sep + 'my-svc']).catch(() => {
139139
var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-svc.service.ts');
140140
expect(existsSync(testPath)).to.equal(false);
141141
});

tests/acceptance/github-pages-deploy.spec.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ describe('Acceptance: ng github-pages:deploy', function() {
5858
it('should fail with uncommited changes', function() {
5959
execStub.addExecSuccess('git status --porcelain', 'M dir/file.ext');
6060
return ng(['github-pages:deploy', '--skip-build'])
61-
.then((ret) => expect(ret).to.equal(1))
61+
.catch((ret) => {
62+
expect(ret.name).to.equal('SilentError');
63+
expect(ret.isSilentError).to.equal(true);
64+
});
6265
});
6366

6467
it('should deploy with defaults to existing remote', function() {
@@ -226,7 +229,10 @@ describe('Acceptance: ng github-pages:deploy', function() {
226229

227230
return ng(['github-pages:deploy', '--skip-build', `--gh-token=${token}`,
228231
`--gh-username=${username}`])
229-
.then((ret) => expect(ret).to.equal(1))
232+
.catch((ret) => {
233+
expect(ret.name).to.equal('SilentError');
234+
expect(ret.isSilentError).to.equal(true);
235+
})
230236
.then(() => httpsStub.restore());
231237
});
232238
});

tests/acceptance/new.spec.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ describe('Acceptance: ng new', function () {
6464
return ng(['new', 'foo', '--skip-npm', '--skip-bower']).then(confirmBlueprinted);
6565
});
6666

67-
it('ng new with empty app name doesnt throw exception', function () {
68-
return ng(['new', '']);
67+
it('ng new with empty app does throw exception', function () {
68+
expect(ng(['new', ''])).to.throw;
6969
});
7070

71-
it('ng new without app name doesnt throw exception', function () {
72-
return ng(['new']);
71+
it('ng new without app name does throw exception', function () {
72+
expect(ng(['new', ''])).to.throw;
7373
});
7474

7575
it('ng new with app name creates new directory and has a dasherized package name', function () {
@@ -81,14 +81,13 @@ describe('Acceptance: ng new', function () {
8181
});
8282
});
8383

84-
it('Cannot run ng new, inside of ember-cli project', function () {
85-
return ng(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git'])
86-
.then(function () {
87-
return ng(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git']).then(function () {
88-
expect(!existsSync('foo'));
89-
});
90-
})
91-
.then(confirmBlueprinted);
84+
return ng(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git'])
85+
.then(function () {
86+
return ng(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git']).catch(function () {
87+
expect(!existsSync('foo'));
88+
});
89+
})
90+
.then(confirmBlueprinted);
9291
});
9392

9493
it('ng new with blueprint uses the specified blueprint directory with a relative path',

tests/e2e/e2e_workflow.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('Basic end-to-end Workflow', function () {
6868
var envContent = fs.readFileSync(envPath, { encoding: 'utf8' });
6969
expect(envContent).to.include('production:true');
7070
// Also does not create new things in GIT.
71-
expect(sh.exec('git status --porcelain').output).to.be.equal('');
71+
expect(sh.exec('git status --porcelain').output).to.be.equal(undefined);
7272
});
7373

7474
it('Can run `ng build` in created project', function () {
@@ -80,7 +80,7 @@ describe('Basic end-to-end Workflow', function () {
8080
})
8181
.then(function () {
8282
// Also does not create new things in GIT.
83-
expect(sh.exec('git status --porcelain').output).to.be.equal('');
83+
expect(sh.exec('git status --porcelain').output).to.be.equal(undefined);
8484
})
8585
.catch(() => {
8686
throw new Error('Build failed.');

0 commit comments

Comments
 (0)