Properly handle promise in create script (#784)

* Properly handle promise in create script

* Add regression test
This commit is contained in:
Raphael von der Grün
2019-07-17 09:52:19 +02:00
committed by GitHub
parent 997943a194
commit 1de7c38134
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -213,6 +213,17 @@ describe('create', function () {
expect(err.message).toContain('Project already exists!');
}).done(done);
});
it('should fail if validateProjectName rejects', () => {
const fakeError = new Error();
create.validateProjectName.and.callFake(() => Promise.reject(fakeError));
return create.create(project_path, config_mock, {}, events_mock).then(() => {
fail('Expected promise to be rejected');
}, err => {
expect(err).toBe(fakeError);
});
});
});
describe('happy path', function () {
it('should copy project templates from a specified custom template', function (done) {