Fail test if promise unexpectedly resolves
diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js
index 1a51e2e..62ef949 100644
--- a/spec/fetch.spec.js
+++ b/spec/fetch.spec.js
@@ -307,9 +307,8 @@
it('should fail fetching a module that does not exist on npm', function () {
return fetch('NOTAMODULE', tmpDir, opts)
.then(function (result) {
- console.log('This should fail and it should not be seen');
- })
- .fail(function (err) {
+ fail('Expected promise to be rejected');
+ }, function (err) {
expect(err.message.code).toBe(1);
expect(err).toBeDefined();
});
@@ -333,9 +332,8 @@
it('should fail fetching a giturl which contains a subdirectory', function () {
return fetch('https://github.com/apache/cordova-plugins.git#:keyboard', tmpDir, opts)
.then(function (result) {
- console.log('This should fail and it should not be seen');
- })
- .fail(function (err) {
+ fail('Expected promise to be rejected');
+ }, function (err) {
expect(err.message.code).toBe(1);
expect(err).toBeDefined();
});