Run Prettier on all files
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
getJasmineRequireObj().toBeInstanceOf = function(j$) {
|
||||
var usageError = j$.formatErrorMsg('<toBeInstanceOf>', 'expect(value).toBeInstanceOf(<ConstructorFunction>)');
|
||||
var usageError = j$.formatErrorMsg(
|
||||
'<toBeInstanceOf>',
|
||||
'expect(value).toBeInstanceOf(<ConstructorFunction>)'
|
||||
);
|
||||
|
||||
/**
|
||||
* {@link expect} the actual to be an instance of the expected class
|
||||
@@ -15,27 +18,42 @@ getJasmineRequireObj().toBeInstanceOf = function(j$) {
|
||||
function toBeInstanceOf(matchersUtil) {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
var actualType = actual && actual.constructor ? j$.fnNameFor(actual.constructor) : matchersUtil.pp(actual),
|
||||
expectedType = expected ? j$.fnNameFor(expected) : matchersUtil.pp(expected),
|
||||
expectedMatcher,
|
||||
pass;
|
||||
var actualType =
|
||||
actual && actual.constructor
|
||||
? j$.fnNameFor(actual.constructor)
|
||||
: matchersUtil.pp(actual),
|
||||
expectedType = expected
|
||||
? j$.fnNameFor(expected)
|
||||
: matchersUtil.pp(expected),
|
||||
expectedMatcher,
|
||||
pass;
|
||||
|
||||
try {
|
||||
expectedMatcher = new j$.Any(expected);
|
||||
pass = expectedMatcher.asymmetricMatch(actual);
|
||||
expectedMatcher = new j$.Any(expected);
|
||||
pass = expectedMatcher.asymmetricMatch(actual);
|
||||
} catch (error) {
|
||||
throw new Error(usageError('Expected value is not a constructor function'));
|
||||
throw new Error(
|
||||
usageError('Expected value is not a constructor function')
|
||||
);
|
||||
}
|
||||
|
||||
if (pass) {
|
||||
return {
|
||||
pass: true,
|
||||
message: 'Expected instance of ' + actualType + ' not to be an instance of ' + expectedType
|
||||
message:
|
||||
'Expected instance of ' +
|
||||
actualType +
|
||||
' not to be an instance of ' +
|
||||
expectedType
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
pass: false,
|
||||
message: 'Expected instance of ' + actualType + ' to be an instance of ' + expectedType
|
||||
message:
|
||||
'Expected instance of ' +
|
||||
actualType +
|
||||
' to be an instance of ' +
|
||||
expectedType
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user