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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user