Merge branch 'improve_toBeRejectedWithError' of https://github.com/andiz2/jasmine
This commit is contained in:
@@ -4334,7 +4334,9 @@ getJasmineRequireObj().toBePending = function(j$) {
|
||||
return {
|
||||
compare: function(actual) {
|
||||
if (!j$.isPromiseLike(actual)) {
|
||||
throw new Error('Expected toBePending to be called on a promise.');
|
||||
throw new Error(
|
||||
`Expected toBePending to be called on a promise but was on a ${typeof actual}.`
|
||||
);
|
||||
}
|
||||
const want = {};
|
||||
return Promise.race([actual, Promise.resolve(want)]).then(
|
||||
@@ -4366,7 +4368,9 @@ getJasmineRequireObj().toBeRejected = function(j$) {
|
||||
return {
|
||||
compare: function(actual) {
|
||||
if (!j$.isPromiseLike(actual)) {
|
||||
throw new Error('Expected toBeRejected to be called on a promise.');
|
||||
throw new Error(
|
||||
`Expected toBeRejected to be called on a promise but was on a ${typeof actual}.`
|
||||
);
|
||||
}
|
||||
return actual.then(
|
||||
function() {
|
||||
@@ -4399,7 +4403,7 @@ getJasmineRequireObj().toBeRejectedWith = function(j$) {
|
||||
compare: function(actualPromise, expectedValue) {
|
||||
if (!j$.isPromiseLike(actualPromise)) {
|
||||
throw new Error(
|
||||
'Expected toBeRejectedWith to be called on a promise.'
|
||||
`Expected toBeRejectedWith to be called on a promise but was on a ${typeof actualPromise}.`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4463,7 +4467,7 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
|
||||
compare: function(actualPromise, arg1, arg2) {
|
||||
if (!j$.isPromiseLike(actualPromise)) {
|
||||
throw new Error(
|
||||
'Expected toBeRejectedWithError to be called on a promise.'
|
||||
`Expected toBeRejectedWithError to be called on a promise but was on a ${typeof actualPromise}.`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4581,7 +4585,9 @@ getJasmineRequireObj().toBeResolved = function(j$) {
|
||||
return {
|
||||
compare: function(actual) {
|
||||
if (!j$.isPromiseLike(actual)) {
|
||||
throw new Error('Expected toBeResolved to be called on a promise.');
|
||||
throw new Error(
|
||||
`Expected toBeResolved to be called on a promise but was on a ${typeof actual}.`
|
||||
);
|
||||
}
|
||||
|
||||
return actual.then(
|
||||
@@ -4621,7 +4627,9 @@ getJasmineRequireObj().toBeResolvedTo = function(j$) {
|
||||
return {
|
||||
compare: function(actualPromise, expectedValue) {
|
||||
if (!j$.isPromiseLike(actualPromise)) {
|
||||
throw new Error('Expected toBeResolvedTo to be called on a promise.');
|
||||
throw new Error(
|
||||
`Expected toBeResolvedTo to be called on a promise but was on a ${typeof actualPromise}.`
|
||||
);
|
||||
}
|
||||
|
||||
function prefix(passed) {
|
||||
|
||||
Reference in New Issue
Block a user