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