Use one declaration per statement

The old style of merging all of a function's variable declarations into
a single statement made some sense back in the days of var, but there's
no reason to keep doing it now that we use const and let.
This commit is contained in:
Steve Gravrock
2026-03-10 20:02:42 -07:00
parent 03ebebf6fb
commit 434575f49d
88 changed files with 3650 additions and 3604 deletions

View File

@@ -1,8 +1,8 @@
describe('toBePending', function() {
it('passes if the actual promise is pending', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBePending(matchersUtil),
actual = new Promise(function() {});
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBePending(matchersUtil);
const actual = new Promise(function() {});
return matcher.compare(actual).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: true }));
@@ -10,9 +10,9 @@ describe('toBePending', function() {
});
it('fails if the actual promise is resolved', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBePending(matchersUtil),
actual = Promise.resolve();
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBePending(matchersUtil);
const actual = Promise.resolve();
return matcher.compare(actual).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: false }));
@@ -20,9 +20,9 @@ describe('toBePending', function() {
});
it('fails if the actual promise is rejected', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBePending(matchersUtil),
actual = Promise.reject(new Error('promise was rejected'));
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBePending(matchersUtil);
const actual = Promise.reject(new Error('promise was rejected'));
return matcher.compare(actual).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: false }));
@@ -30,9 +30,9 @@ describe('toBePending', function() {
});
it('fails if actual is not a promise', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBePending(matchersUtil),
actual = 'not a promise';
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBePending(matchersUtil);
const actual = 'not a promise';
function f() {
return matcher.compare(actual);

View File

@@ -1,8 +1,8 @@
describe('toBeRejected', function() {
it('passes if the actual is rejected', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeRejected(matchersUtil),
actual = Promise.reject('AsyncExpectationSpec rejection');
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBeRejected(matchersUtil);
const actual = Promise.reject('AsyncExpectationSpec rejection');
return matcher.compare(actual).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: true }));
@@ -10,9 +10,9 @@ describe('toBeRejected', function() {
});
it('fails if the actual is resolved', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeRejected(matchersUtil),
actual = Promise.resolve();
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBeRejected(matchersUtil);
const actual = Promise.resolve();
return matcher.compare(actual).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: false }));
@@ -20,9 +20,9 @@ describe('toBeRejected', function() {
});
it('fails if actual is not a promise', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeRejected(matchersUtil),
actual = 'not a promise';
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBeRejected(matchersUtil);
const actual = 'not a promise';
function f() {
return matcher.compare(actual);

View File

@@ -1,12 +1,12 @@
describe('#toBeRejectedWithError', function() {
it('passes when Error type matches', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new TypeError('foo'));
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject(new TypeError('foo'));
return matcher.compare(actual, TypeError).then(function(result) {
expect(result).toEqual(
@@ -21,12 +21,12 @@ describe('#toBeRejectedWithError', function() {
it('passes when Error type and message matches', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new TypeError('foo'));
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject(new TypeError('foo'));
return matcher.compare(actual, TypeError, 'foo').then(function(result) {
expect(result).toEqual(
@@ -41,12 +41,12 @@ describe('#toBeRejectedWithError', function() {
it('passes when Error matches and is exactly Error', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error());
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject(new Error());
return matcher.compare(actual, Error).then(function(result) {
expect(result).toEqual(
@@ -61,12 +61,12 @@ describe('#toBeRejectedWithError', function() {
it('passes when Error message matches a string', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error('foo'));
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject(new Error('foo'));
return matcher.compare(actual, 'foo').then(function(result) {
expect(result).toEqual(
@@ -81,12 +81,12 @@ describe('#toBeRejectedWithError', function() {
it('passes when Error message matches a RegExp', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error('foo'));
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject(new Error('foo'));
return matcher.compare(actual, /foo/).then(function(result) {
expect(result).toEqual(
@@ -101,12 +101,12 @@ describe('#toBeRejectedWithError', function() {
it('passes when Error message is empty', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error());
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject(new Error());
return matcher.compare(actual, '').then(function(result) {
expect(result).toEqual(
@@ -121,12 +121,12 @@ describe('#toBeRejectedWithError', function() {
it('passes when no arguments', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error());
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject(new Error());
return matcher.compare(actual, void 0).then(function(result) {
expect(result).toEqual(
@@ -141,12 +141,12 @@ describe('#toBeRejectedWithError', function() {
it('fails when resolved', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.resolve(new Error('foo'));
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.resolve(new Error('foo'));
return matcher.compare(actual, 'foo').then(function(result) {
expect(result).toEqual(
@@ -160,12 +160,12 @@ describe('#toBeRejectedWithError', function() {
it('fails when rejected with non Error type', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject('foo');
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject('foo');
return matcher.compare(actual, 'foo').then(function(result) {
expect(result).toEqual(
@@ -180,12 +180,12 @@ describe('#toBeRejectedWithError', function() {
it('fails when Error type mismatches', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error('foo'));
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject(new Error('foo'));
return matcher.compare(actual, TypeError, 'foo').then(function(result) {
expect(result).toEqual(
@@ -200,12 +200,12 @@ describe('#toBeRejectedWithError', function() {
it('fails when Error message mismatches', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error('foo'));
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = Promise.reject(new Error('foo'));
return matcher.compare(actual, 'bar').then(function(result) {
expect(result).toEqual(
@@ -220,12 +220,12 @@ describe('#toBeRejectedWithError', function() {
it('fails if actual is not a promise', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = 'not a promise';
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
);
const actual = 'not a promise';
function f() {
return matcher.compare(actual);

View File

@@ -1,8 +1,8 @@
describe('#toBeRejectedWithMatching', function() {
it('passes if the promise is rejected with something matching the predicate', function() {
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching(),
actual = Promise.reject(new Error('nope')),
predicate = value => value.message === 'nope';
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching();
const actual = Promise.reject(new Error('nope'));
const predicate = value => value.message === 'nope';
return matcher.compare(actual, predicate).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: true }));
@@ -10,9 +10,9 @@ describe('#toBeRejectedWithMatching', function() {
});
it('fails if the promise resolves', function() {
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching(),
actual = Promise.resolve(),
predicate = () => true;
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching();
const actual = Promise.resolve();
const predicate = () => true;
return matcher.compare(actual, predicate).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: false }));
@@ -20,9 +20,9 @@ describe('#toBeRejectedWithMatching', function() {
});
it('fails if the promise is rejected with something not matching the predicate', function() {
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching(),
actual = Promise.reject('A Bad Apple'),
predicate = value => value === 'A Good Orange';
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching();
const actual = Promise.reject('A Bad Apple');
const predicate = value => value === 'A Good Orange';
return matcher.compare(actual, predicate).then(function(result) {
expect(result).toEqual(
@@ -36,9 +36,9 @@ describe('#toBeRejectedWithMatching', function() {
});
it('should build its error correctly when negated', function() {
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching(),
actual = Promise.reject(true),
predicate = () => true;
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching();
const actual = Promise.reject(true);
const predicate = () => true;
return matcher.compare(actual, predicate).then(function(result) {
expect(result).toEqual(
@@ -52,8 +52,8 @@ describe('#toBeRejectedWithMatching', function() {
});
it('fails if actual is not a promise', function() {
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching(),
actual = 'not a promise';
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching();
const actual = 'not a promise';
function f() {
return matcher.compare(actual);
@@ -65,9 +65,9 @@ describe('#toBeRejectedWithMatching', function() {
});
it('fails if predicate is not a function', function() {
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching(),
actual = Promise.resolve(),
predicate = 'not a function';
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWithMatching();
const actual = Promise.resolve();
const predicate = 'not a function';
function f() {
return matcher.compare(actual, predicate);

View File

@@ -1,8 +1,10 @@
describe('#toBeRejectedWith', function() {
it('should return true if the promise is rejected with the expected value', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.reject({ error: 'PEBCAK' });
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(
matchersUtil
);
const actual = Promise.reject({ error: 'PEBCAK' });
return matcher.compare(actual, { error: 'PEBCAK' }).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: true }));
@@ -10,9 +12,11 @@ describe('#toBeRejectedWith', function() {
});
it('should fail if the promise resolves', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.resolve();
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(
matchersUtil
);
const actual = Promise.resolve();
return matcher.compare(actual, '').then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: false }));
@@ -21,10 +25,12 @@ describe('#toBeRejectedWith', function() {
it('should fail if the promise is rejected with a different value', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.reject('A Bad Apple');
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(
matchersUtil
);
const actual = Promise.reject('A Bad Apple');
return matcher.compare(actual, 'Some Cool Thing').then(function(result) {
expect(result).toEqual(
@@ -39,10 +45,12 @@ describe('#toBeRejectedWith', function() {
it('should build its error correctly when negated', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.reject(true);
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(
matchersUtil
);
const actual = Promise.reject(true);
return matcher.compare(actual, true).then(function(result) {
expect(result).toEqual(
@@ -56,15 +64,17 @@ describe('#toBeRejectedWith', function() {
it('should support custom equality testers', function() {
const customEqualityTesters = [
function() {
return true;
}
],
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: customEqualityTesters
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.reject('actual');
function() {
return true;
}
];
const matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: customEqualityTesters
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(
matchersUtil
);
const actual = Promise.reject('actual');
return matcher.compare(actual, 'expected').then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: true }));
@@ -73,10 +83,12 @@ describe('#toBeRejectedWith', function() {
it('fails if actual is not a promise', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = 'not a promise';
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(
matchersUtil
);
const actual = 'not a promise';
function f() {
return matcher.compare(actual);

View File

@@ -1,8 +1,8 @@
describe('toBeResolved', function() {
it('passes if the actual is resolved', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeResolved(matchersUtil),
actual = Promise.resolve();
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBeResolved(matchersUtil);
const actual = Promise.resolve();
return matcher.compare(actual).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: true }));
@@ -11,10 +11,10 @@ describe('toBeResolved', function() {
it('fails if the actual is rejected', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter([])
}),
matcher = privateUnderTest.asyncMatchers.toBeResolved(matchersUtil),
actual = Promise.reject(new Error('AsyncExpectationSpec rejection'));
pp: privateUnderTest.makePrettyPrinter([])
});
const matcher = privateUnderTest.asyncMatchers.toBeResolved(matchersUtil);
const actual = Promise.reject(new Error('AsyncExpectationSpec rejection'));
return matcher.compare(actual).then(function(result) {
expect(result).toEqual({
@@ -27,9 +27,9 @@ describe('toBeResolved', function() {
});
it('fails if actual is not a promise', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeResolved(matchersUtil),
actual = 'not a promise';
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBeResolved(matchersUtil);
const actual = 'not a promise';
function f() {
return matcher.compare(actual);

View File

@@ -1,8 +1,8 @@
describe('#toBeResolvedTo', function() {
it('passes if the promise is resolved to the expected value', function() {
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.resolve({ foo: 42 });
const matchersUtil = new privateUnderTest.MatchersUtil();
const matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil);
const actual = Promise.resolve({ foo: 42 });
return matcher.compare(actual, { foo: 42 }).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: true }));
@@ -11,10 +11,10 @@ describe('#toBeResolvedTo', function() {
it('fails if the promise is rejected', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.reject(new Error('AsyncExpectationSpec error'));
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil);
const actual = Promise.reject(new Error('AsyncExpectationSpec error'));
return matcher.compare(actual, '').then(function(result) {
expect(result).toEqual(
@@ -30,10 +30,10 @@ describe('#toBeResolvedTo', function() {
it('fails if the promise is resolved to a different value', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.resolve({ foo: 17 });
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil);
const actual = Promise.resolve({ foo: 17 });
return matcher.compare(actual, { foo: 42 }).then(function(result) {
expect(result).toEqual(
@@ -48,10 +48,10 @@ describe('#toBeResolvedTo', function() {
it('builds its message correctly when negated', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.resolve(true);
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil);
const actual = Promise.resolve(true);
return matcher.compare(actual, true).then(function(result) {
expect(result).toEqual(
@@ -65,16 +65,16 @@ describe('#toBeResolvedTo', function() {
it('supports custom equality testers', function() {
const customEqualityTesters = [
function() {
return true;
}
],
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: customEqualityTesters,
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.resolve('actual');
function() {
return true;
}
];
const matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: customEqualityTesters,
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil);
const actual = Promise.resolve('actual');
return matcher.compare(actual, 'expected').then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: true }));
@@ -83,10 +83,10 @@ describe('#toBeResolvedTo', function() {
it('fails if actual is not a promise', function() {
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = 'not a promise';
pp: privateUnderTest.makePrettyPrinter()
});
const matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil);
const actual = 'not a promise';
function f() {
return matcher.compare(actual);