Merge branch '6.0'

This commit is contained in:
Steve Gravrock
2025-12-01 17:48:49 -08:00
266 changed files with 10971 additions and 6448 deletions

View File

@@ -1,6 +1,6 @@
describe('DiffBuilder', function() {
it('records the actual and expected objects', function() {
const diffBuilder = new jasmineUnderTest.DiffBuilder();
const diffBuilder = new privateUnderTest.DiffBuilder();
diffBuilder.setRoots({ x: 'actual' }, { x: 'expected' });
diffBuilder.recordMismatch();
@@ -10,7 +10,7 @@ describe('DiffBuilder', function() {
});
it('prints the path at which the difference was found', function() {
const diffBuilder = new jasmineUnderTest.DiffBuilder();
const diffBuilder = new privateUnderTest.DiffBuilder();
diffBuilder.setRoots({ foo: { x: 'actual' } }, { foo: { x: 'expected' } });
diffBuilder.withPath('foo', function() {
@@ -23,7 +23,7 @@ describe('DiffBuilder', function() {
});
it('prints multiple messages, separated by newlines', function() {
const diffBuilder = new jasmineUnderTest.DiffBuilder();
const diffBuilder = new privateUnderTest.DiffBuilder();
diffBuilder.setRoots({ foo: 1, bar: 3 }, { foo: 2, bar: 4 });
diffBuilder.withPath('foo', function() {
@@ -40,7 +40,7 @@ describe('DiffBuilder', function() {
});
it('allows customization of the message', function() {
const diffBuilder = new jasmineUnderTest.DiffBuilder();
const diffBuilder = new privateUnderTest.DiffBuilder();
diffBuilder.setRoots({ x: 'bar' }, { x: 'foo' });
function darthVaderFormatter(actual, expected, path) {
@@ -68,7 +68,7 @@ describe('DiffBuilder', function() {
const prettyPrinter = function(val) {
return '|' + val + '|';
},
diffBuilder = new jasmineUnderTest.DiffBuilder({
diffBuilder = new privateUnderTest.DiffBuilder({
prettyPrinter: prettyPrinter
});
prettyPrinter.customFormat_ = function() {};
@@ -86,7 +86,7 @@ describe('DiffBuilder', function() {
it('passes the injected pretty-printer to the diff formatter', function() {
const diffFormatter = jasmine.createSpy('diffFormatter'),
prettyPrinter = function() {},
diffBuilder = new jasmineUnderTest.DiffBuilder({
diffBuilder = new privateUnderTest.DiffBuilder({
prettyPrinter: prettyPrinter
});
prettyPrinter.customFormat_ = function() {};
@@ -112,8 +112,8 @@ describe('DiffBuilder', function() {
return '[number:' + x + ']';
}
};
const prettyPrinter = jasmineUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new jasmineUnderTest.DiffBuilder({
const prettyPrinter = privateUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new privateUnderTest.DiffBuilder({
prettyPrinter: prettyPrinter
});
@@ -131,8 +131,8 @@ describe('DiffBuilder', function() {
return '[thing with a=' + x.a + ', b=' + JSON.stringify(x.b) + ']';
}
};
const prettyPrinter = jasmineUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new jasmineUnderTest.DiffBuilder({
const prettyPrinter = privateUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new privateUnderTest.DiffBuilder({
prettyPrinter: prettyPrinter
});
const expectedMsg =
@@ -167,8 +167,8 @@ describe('DiffBuilder', function() {
return '[number:' + x + ']';
}
};
const prettyPrinter = jasmineUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new jasmineUnderTest.DiffBuilder({
const prettyPrinter = privateUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new privateUnderTest.DiffBuilder({
prettyPrinter: prettyPrinter
});
@@ -186,8 +186,8 @@ describe('DiffBuilder', function() {
return '[number:' + x + ']';
}
};
const prettyPrinter = jasmineUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new jasmineUnderTest.DiffBuilder({
const prettyPrinter = privateUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new privateUnderTest.DiffBuilder({
prettyPrinter: prettyPrinter
});
@@ -205,8 +205,8 @@ describe('DiffBuilder', function() {
return '[number:' + x + ']';
}
};
const prettyPrinter = jasmineUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new jasmineUnderTest.DiffBuilder({
const prettyPrinter = privateUnderTest.makePrettyPrinter([formatter]);
const diffBuilder = new privateUnderTest.DiffBuilder({
prettyPrinter: prettyPrinter
});
@@ -219,8 +219,8 @@ describe('DiffBuilder', function() {
});
it('builds diffs involving asymmetric equality testers that implement valuesForDiff_ at the root', function() {
const prettyPrinter = jasmineUnderTest.makePrettyPrinter([]),
diffBuilder = new jasmineUnderTest.DiffBuilder({
const prettyPrinter = privateUnderTest.makePrettyPrinter([]),
diffBuilder = new privateUnderTest.DiffBuilder({
prettyPrinter: prettyPrinter
}),
expectedMsg =
@@ -243,8 +243,8 @@ describe('DiffBuilder', function() {
});
it('builds diffs involving asymmetric equality testers that implement valuesForDiff_ below the root', function() {
const prettyPrinter = jasmineUnderTest.makePrettyPrinter([]),
diffBuilder = new jasmineUnderTest.DiffBuilder({
const prettyPrinter = privateUnderTest.makePrettyPrinter([]),
diffBuilder = new privateUnderTest.DiffBuilder({
prettyPrinter: prettyPrinter
}),
expectedMsg =

View File

@@ -2,25 +2,25 @@ describe('MismatchTree', function() {
describe('#add', function() {
describe('When the path is empty', function() {
it('flags the root node as mismatched', function() {
const tree = new jasmineUnderTest.MismatchTree();
tree.add(new jasmineUnderTest.ObjectPath([]));
const tree = new privateUnderTest.MismatchTree();
tree.add(new privateUnderTest.ObjectPath([]));
expect(tree.isMismatch).toBe(true);
});
});
describe('When the path is not empty', function() {
it('flags the node as mismatched', function() {
const tree = new jasmineUnderTest.MismatchTree();
const tree = new privateUnderTest.MismatchTree();
tree.add(new jasmineUnderTest.ObjectPath(['a', 'b']));
tree.add(new privateUnderTest.ObjectPath(['a', 'b']));
expect(tree.child('a').child('b').isMismatch).toBe(true);
});
it('does not flag ancestors as mismatched', function() {
const tree = new jasmineUnderTest.MismatchTree();
const tree = new privateUnderTest.MismatchTree();
tree.add(new jasmineUnderTest.ObjectPath(['a', 'b']));
tree.add(new privateUnderTest.ObjectPath(['a', 'b']));
expect(tree.isMismatch).toBe(false);
expect(tree.child('a').isMismatch).toBe(false);
@@ -28,9 +28,9 @@ describe('MismatchTree', function() {
});
it('stores the formatter on only the target node', function() {
const tree = new jasmineUnderTest.MismatchTree();
const tree = new privateUnderTest.MismatchTree();
tree.add(new jasmineUnderTest.ObjectPath(['a', 'b']), formatter);
tree.add(new privateUnderTest.ObjectPath(['a', 'b']), formatter);
expect(tree.formatter).toBeFalsy();
expect(tree.child('a').formatter).toBeFalsy();
@@ -38,9 +38,9 @@ describe('MismatchTree', function() {
});
it('stores the path to the node', function() {
const tree = new jasmineUnderTest.MismatchTree();
const tree = new privateUnderTest.MismatchTree();
tree.add(new jasmineUnderTest.ObjectPath(['a', 'b']), formatter);
tree.add(new privateUnderTest.ObjectPath(['a', 'b']), formatter);
expect(tree.child('a').child('b').path.components).toEqual(['a', 'b']);
});
@@ -48,37 +48,37 @@ describe('MismatchTree', function() {
describe('#traverse', function() {
it('calls the callback for all nodes that are or contain mismatches', function() {
const tree = new jasmineUnderTest.MismatchTree();
tree.add(new jasmineUnderTest.ObjectPath(['a', 'b']), formatter);
tree.add(new jasmineUnderTest.ObjectPath(['c']));
const tree = new privateUnderTest.MismatchTree();
tree.add(new privateUnderTest.ObjectPath(['a', 'b']), formatter);
tree.add(new privateUnderTest.ObjectPath(['c']));
const visit = jasmine.createSpy('visit').and.returnValue(true);
tree.traverse(visit);
expect(visit).toHaveBeenCalledWith(
new jasmineUnderTest.ObjectPath([]),
new privateUnderTest.ObjectPath([]),
false,
undefined
);
expect(visit).toHaveBeenCalledWith(
new jasmineUnderTest.ObjectPath(['a']),
new privateUnderTest.ObjectPath(['a']),
false,
undefined
);
expect(visit).toHaveBeenCalledWith(
new jasmineUnderTest.ObjectPath(['a', 'b']),
new privateUnderTest.ObjectPath(['a', 'b']),
true,
formatter
);
expect(visit).toHaveBeenCalledWith(
new jasmineUnderTest.ObjectPath(['c']),
new privateUnderTest.ObjectPath(['c']),
true,
undefined
);
});
it('does not call the callback if there are no mismatches', function() {
const tree = new jasmineUnderTest.MismatchTree();
const tree = new privateUnderTest.MismatchTree();
const visit = jasmine.createSpy('visit');
tree.traverse(visit);
@@ -87,8 +87,8 @@ describe('MismatchTree', function() {
});
it('visits parents before children', function() {
const tree = new jasmineUnderTest.MismatchTree();
tree.add(new jasmineUnderTest.ObjectPath(['a', 'b']));
const tree = new privateUnderTest.MismatchTree();
tree.add(new privateUnderTest.ObjectPath(['a', 'b']));
const visited = [];
tree.traverse(function(path) {
@@ -97,16 +97,16 @@ describe('MismatchTree', function() {
});
expect(visited).toEqual([
new jasmineUnderTest.ObjectPath([]),
new jasmineUnderTest.ObjectPath(['a']),
new jasmineUnderTest.ObjectPath(['a', 'b'])
new privateUnderTest.ObjectPath([]),
new privateUnderTest.ObjectPath(['a']),
new privateUnderTest.ObjectPath(['a', 'b'])
]);
});
it('visits children in the order they were recorded', function() {
const tree = new jasmineUnderTest.MismatchTree();
tree.add(new jasmineUnderTest.ObjectPath(['length']));
tree.add(new jasmineUnderTest.ObjectPath([1]));
const tree = new privateUnderTest.MismatchTree();
tree.add(new privateUnderTest.ObjectPath(['length']));
tree.add(new privateUnderTest.ObjectPath([1]));
const visited = [];
tree.traverse(function(path) {
@@ -115,15 +115,15 @@ describe('MismatchTree', function() {
});
expect(visited).toEqual([
new jasmineUnderTest.ObjectPath([]),
new jasmineUnderTest.ObjectPath(['length']),
new jasmineUnderTest.ObjectPath([1])
new privateUnderTest.ObjectPath([]),
new privateUnderTest.ObjectPath(['length']),
new privateUnderTest.ObjectPath([1])
]);
});
it('does not visit children if the callback returns falsy', function() {
const tree = new jasmineUnderTest.MismatchTree();
tree.add(new jasmineUnderTest.ObjectPath(['a', 'b']));
const tree = new privateUnderTest.MismatchTree();
tree.add(new privateUnderTest.ObjectPath(['a', 'b']));
const visited = [];
tree.traverse(function(path) {
@@ -132,8 +132,8 @@ describe('MismatchTree', function() {
});
expect(visited).toEqual([
new jasmineUnderTest.ObjectPath([]),
new jasmineUnderTest.ObjectPath(['a'])
new privateUnderTest.ObjectPath([]),
new privateUnderTest.ObjectPath(['a'])
]);
});
});

View File

@@ -1,7 +1,7 @@
describe('NullDiffBuilder', function() {
it('responds to withPath() by calling the passed function', function() {
const spy = jasmine.createSpy('callback');
jasmineUnderTest.NullDiffBuilder().withPath('does not matter', spy);
privateUnderTest.NullDiffBuilder().withPath('does not matter', spy);
expect(spy).toHaveBeenCalled();
});
});

View File

@@ -1,5 +1,5 @@
describe('ObjectPath', function() {
const ObjectPath = jasmineUnderTest.ObjectPath;
const ObjectPath = privateUnderTest.ObjectPath;
it('represents the path to a node in an object tree', function() {
expect(new ObjectPath(['foo', 'bar']).toString()).toEqual('$.foo.bar');

View File

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

View File

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

View File

@@ -1,9 +1,9 @@
describe('#toBeRejectedWithError', function() {
it('passes when Error type matches', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new TypeError('foo'));
@@ -20,10 +20,10 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error type and message matches', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new TypeError('foo'));
@@ -40,10 +40,10 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error matches and is exactly Error', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error());
@@ -60,10 +60,10 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error message matches a string', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error('foo'));
@@ -80,10 +80,10 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error message matches a RegExp', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error('foo'));
@@ -100,10 +100,10 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when Error message is empty', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error());
@@ -120,10 +120,10 @@ describe('#toBeRejectedWithError', function() {
});
it('passes when no arguments', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error());
@@ -140,10 +140,10 @@ describe('#toBeRejectedWithError', function() {
});
it('fails when resolved', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.resolve(new Error('foo'));
@@ -159,10 +159,10 @@ describe('#toBeRejectedWithError', function() {
});
it('fails when rejected with non Error type', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject('foo');
@@ -179,10 +179,10 @@ describe('#toBeRejectedWithError', function() {
});
it('fails when Error type mismatches', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error('foo'));
@@ -199,10 +199,10 @@ describe('#toBeRejectedWithError', function() {
});
it('fails when Error message mismatches', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = Promise.reject(new Error('foo'));
@@ -219,10 +219,10 @@ describe('#toBeRejectedWithError', function() {
});
it('fails if actual is not a promise', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWithError(
matcher = privateUnderTest.asyncMatchers.toBeRejectedWithError(
matchersUtil
),
actual = 'not a promise';

View File

@@ -1,7 +1,7 @@
describe('#toBeRejectedWith', function() {
it('should return true if the promise is rejected with the expected value', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.reject({ error: 'PEBCAK' });
return matcher.compare(actual, { error: 'PEBCAK' }).then(function(result) {
@@ -10,8 +10,8 @@ describe('#toBeRejectedWith', function() {
});
it('should fail if the promise resolves', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.resolve();
return matcher.compare(actual, '').then(function(result) {
@@ -20,10 +20,10 @@ describe('#toBeRejectedWith', function() {
});
it('should fail if the promise is rejected with a different value', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.reject('A Bad Apple');
return matcher.compare(actual, 'Some Cool Thing').then(function(result) {
@@ -38,10 +38,10 @@ describe('#toBeRejectedWith', function() {
});
it('should build its error correctly when negated', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.reject(true);
return matcher.compare(actual, true).then(function(result) {
@@ -60,10 +60,10 @@ describe('#toBeRejectedWith', function() {
return true;
}
],
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: customEqualityTesters
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = Promise.reject('actual');
return matcher.compare(actual, 'expected').then(function(result) {
@@ -72,10 +72,10 @@ describe('#toBeRejectedWith', function() {
});
it('fails if actual is not a promise', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
matcher = privateUnderTest.asyncMatchers.toBeRejectedWith(matchersUtil),
actual = 'not a promise';
function f() {

View File

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

View File

@@ -1,7 +1,7 @@
describe('#toBeResolvedTo', function() {
it('passes if the promise is resolved to the expected value', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.resolve({ foo: 42 });
return matcher.compare(actual, { foo: 42 }).then(function(result) {
@@ -10,10 +10,10 @@ describe('#toBeResolvedTo', function() {
});
it('fails if the promise is rejected', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.reject(new Error('AsyncExpectationSpec error'));
return matcher.compare(actual, '').then(function(result) {
@@ -29,10 +29,10 @@ describe('#toBeResolvedTo', function() {
});
it('fails if the promise is resolved to a different value', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.resolve({ foo: 17 });
return matcher.compare(actual, { foo: 42 }).then(function(result) {
@@ -47,10 +47,10 @@ describe('#toBeResolvedTo', function() {
});
it('builds its message correctly when negated', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.resolve(true);
return matcher.compare(actual, true).then(function(result) {
@@ -69,11 +69,11 @@ describe('#toBeResolvedTo', function() {
return true;
}
],
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: customEqualityTesters,
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = Promise.resolve('actual');
return matcher.compare(actual, 'expected').then(function(result) {
@@ -82,10 +82,10 @@ describe('#toBeResolvedTo', function() {
});
it('fails if actual is not a promise', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
matcher = privateUnderTest.asyncMatchers.toBeResolvedTo(matchersUtil),
actual = 'not a promise';
function f() {

View File

@@ -1,79 +1,79 @@
describe('matchersUtil', function() {
it('exposes the injected pretty-printer as .pp', function() {
const pp = function() {},
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: pp });
matchersUtil = new privateUnderTest.MatchersUtil({ pp: pp });
expect(matchersUtil.pp).toBe(pp);
});
describe('equals', function() {
it('passes for literals that are triple-equal', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(null, null)).toBe(true);
expect(matchersUtil.equals(void 0, void 0)).toBe(true);
});
it('fails for things that are not equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals({ a: 'foo' }, 1)).toBe(false);
});
it('passes for Strings that are equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals('foo', 'foo')).toBe(true);
});
it('fails for Strings that are not equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals('foo', 'bar')).toBe(false);
});
it('passes for Numbers that are equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(123, 123)).toBe(true);
});
it('fails for Numbers that are not equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(123, 456)).toBe(false);
});
it('fails for a Number and a String that have equivalent values', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(123, '123')).toBe(false);
});
it('passes for Dates that are equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(
matchersUtil.equals(new Date('Jan 1, 1970'), new Date('Jan 1, 1970'))
).toBe(true);
});
it('fails for Dates that are not equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(
matchersUtil.equals(new Date('Jan 1, 1970'), new Date('Feb 3, 1991'))
).toBe(false);
});
it('passes for Booleans that are equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(true, true)).toBe(true);
});
it('fails for Booleans that are not equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(true, false)).toBe(false);
});
it('passes for RegExps that are equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(/foo/, /foo/)).toBe(true);
});
it('fails for RegExps that are not equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(/foo/, /bar/)).toBe(false);
expect(
matchersUtil.equals(new RegExp('foo', 'i'), new RegExp('foo'))
@@ -81,32 +81,32 @@ describe('matchersUtil', function() {
});
it('passes for Arrays that are equivalent', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals([1, 2], [1, 2])).toBe(true);
});
it('passes for Arrays that are equivalent, with elements added by changing length', function() {
const foo = [],
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
foo.length = 1;
expect(matchersUtil.equals(foo, [undefined])).toBe(true);
});
it('fails for Arrays that have different lengths', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals([1, 2], [1, 2, 3])).toBe(false);
});
it('fails for Arrays that have different elements', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals([1, 2, 3], [1, 5, 3])).toBe(false);
});
it('fails for Arrays whose contents are equivalent, but have differing properties', function() {
const one = [1, 2, 3],
two = [1, 2, 3],
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
one.foo = 'bar';
two.foo = 'baz';
@@ -117,7 +117,7 @@ describe('matchersUtil', function() {
it('passes for Arrays with equivalent contents and properties', function() {
const one = [1, 2, 3],
two = [1, 2, 3],
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
one.foo = 'bar';
two.foo = 'bar';
@@ -126,7 +126,7 @@ describe('matchersUtil', function() {
});
it('handles symbol keys in Arrays', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil(),
const matchersUtil = new privateUnderTest.MatchersUtil(),
sym = Symbol('foo'),
arr1 = [];
let arr2 = [];
@@ -148,21 +148,21 @@ describe('matchersUtil', function() {
});
it('passes for Errors that are the same type and have the same message', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(new Error('foo'), new Error('foo'))).toBe(
true
);
});
it('fails for Errors that are the same type and have different messages', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(new Error('foo'), new Error('bar'))).toBe(
false
);
});
it('fails for objects with different constructors', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
function One() {}
function Two() {}
@@ -170,17 +170,17 @@ describe('matchersUtil', function() {
});
it('passes for Objects that are equivalent (simple case)', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals({ a: 'foo' }, { a: 'foo' })).toBe(true);
});
it('fails for Objects that are not equivalent (simple case)', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals({ a: 'foo' }, { a: 'bar' })).toBe(false);
});
it('passes for Objects that are equivalent (deep case)', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(
matchersUtil.equals(
{ a: 'foo', b: { c: 'bar' } },
@@ -190,7 +190,7 @@ describe('matchersUtil', function() {
});
it('fails for Objects that are not equivalent (deep case)', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(
matchersUtil.equals(
{ a: 'foo', b: { c: 'baz' } },
@@ -202,7 +202,7 @@ describe('matchersUtil', function() {
it('passes for Objects that are equivalent (with cycles)', function() {
const actual = { a: 'foo' },
expected = { a: 'foo' },
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
actual.b = actual;
expected.b = actual;
@@ -213,7 +213,7 @@ describe('matchersUtil', function() {
it('fails for Objects that are not equivalent (with cycles)', function() {
const actual = { a: 'foo' },
expected = { a: 'bar' },
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
actual.b = actual;
expected.b = actual;
@@ -224,7 +224,7 @@ describe('matchersUtil', function() {
it('fails for Objects that have the same number of keys, but different keys/values', function() {
const expected = { a: undefined },
actual = { b: 1 },
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(actual, expected)).toBe(false);
});
@@ -232,7 +232,7 @@ describe('matchersUtil', function() {
it('fails when comparing an empty object to an empty array (issue #114)', function() {
const emptyObject = {},
emptyArray = [],
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(emptyObject, emptyArray)).toBe(false);
expect(matchersUtil.equals(emptyArray, emptyObject)).toBe(false);
@@ -241,7 +241,7 @@ describe('matchersUtil', function() {
it('passes for equivalent frozen objects (GitHub issue #266)', function() {
const a = { foo: 1 },
b = { foo: 1 },
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
Object.freeze(a);
Object.freeze(b);
@@ -252,7 +252,7 @@ describe('matchersUtil', function() {
it('passes for equivalent Promises (GitHub issue #1314)', function() {
const p1 = new Promise(function() {}),
p2 = new Promise(function() {}),
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(p1, p1)).toBe(true);
expect(matchersUtil.equals(p1, p2)).toBe(false);
@@ -267,7 +267,7 @@ describe('matchersUtil', function() {
it('passes for equivalent DOM nodes', function() {
const a = document.createElement('div');
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
a.setAttribute('test-attr', 'attr-value');
a.appendChild(document.createTextNode('test'));
@@ -280,7 +280,7 @@ describe('matchersUtil', function() {
});
it('passes for equivalent objects from different frames', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.contentWindow.eval('window.testObject = {}');
@@ -291,7 +291,7 @@ describe('matchersUtil', function() {
});
it('fails for DOM nodes with different attributes or child nodes', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const a = document.createElement('div');
a.setAttribute('test-attr', 'attr-value');
a.appendChild(document.createTextNode('test'));
@@ -321,7 +321,7 @@ describe('matchersUtil', function() {
});
it('passes for equivalent objects from different vm contexts', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const vm = require('vm');
const sandbox = {
obj: null
@@ -332,7 +332,7 @@ describe('matchersUtil', function() {
});
it('passes for equivalent arrays from different vm contexts', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const vm = require('vm');
const sandbox = {
arr: null
@@ -345,8 +345,8 @@ describe('matchersUtil', function() {
it('passes when Any is used', function() {
const number = 3,
anyNumber = new jasmineUnderTest.Any(Number),
matchersUtil = new jasmineUnderTest.MatchersUtil();
anyNumber = new privateUnderTest.Any(Number),
matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(number, anyNumber)).toBe(true);
expect(matchersUtil.equals(anyNumber, number)).toBe(true);
@@ -354,8 +354,8 @@ describe('matchersUtil', function() {
it('fails when Any is compared to something unexpected', function() {
const number = 3,
anyString = new jasmineUnderTest.Any(String),
matchersUtil = new jasmineUnderTest.MatchersUtil();
anyString = new privateUnderTest.Any(String),
matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(number, anyString)).toBe(false);
expect(matchersUtil.equals(anyString, number)).toBe(false);
@@ -366,19 +366,19 @@ describe('matchersUtil', function() {
foo: 3,
bar: 7
},
containing = new jasmineUnderTest.ObjectContaining({ foo: 3 }),
matchersUtil = new jasmineUnderTest.MatchersUtil();
containing = new privateUnderTest.ObjectContaining({ foo: 3 }),
matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(obj, containing)).toBe(true);
expect(matchersUtil.equals(containing, obj)).toBe(true);
});
it('passes when MapContaining is used', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const obj = new Map();
obj.set(1, 2);
obj.set('foo', 'bar');
const containing = new jasmineUnderTest.MapContaining(new Map());
const containing = new privateUnderTest.MapContaining(new Map());
containing.sample.set('foo', 'bar');
expect(matchersUtil.equals(obj, containing)).toBe(true);
@@ -386,11 +386,11 @@ describe('matchersUtil', function() {
});
it('passes when SetContaining is used', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const obj = new Set();
obj.add(1);
obj.add('foo');
const containing = new jasmineUnderTest.SetContaining(new Set());
const containing = new privateUnderTest.SetContaining(new Set());
containing.sample.add(1);
expect(matchersUtil.equals(obj, containing)).toBe(true);
@@ -403,7 +403,7 @@ describe('matchersUtil', function() {
return true;
}
},
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(false, tester)).toBe(true);
expect(matchersUtil.equals(tester, false)).toBe(true);
@@ -415,7 +415,7 @@ describe('matchersUtil', function() {
return false;
}
},
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(true, tester)).toBe(false);
expect(matchersUtil.equals(tester, true)).toBe(false);
@@ -423,10 +423,10 @@ describe('matchersUtil', function() {
it('passes when ArrayContaining is used', function() {
const arr = ['foo', 'bar'],
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
expect(
matchersUtil.equals(arr, new jasmineUnderTest.ArrayContaining(['bar']))
matchersUtil.equals(arr, new privateUnderTest.ArrayContaining(['bar']))
).toBe(true);
});
@@ -434,7 +434,7 @@ describe('matchersUtil', function() {
const tester = function() {
return true;
},
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [tester],
pp: function() {}
});
@@ -443,7 +443,7 @@ describe('matchersUtil', function() {
});
it('passes for two empty Objects', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals({}, {})).toBe(true);
});
@@ -453,7 +453,7 @@ describe('matchersUtil', function() {
};
it('passes for two empty Objects', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
const matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [tester],
pp: function() {}
});
@@ -465,7 +465,7 @@ describe('matchersUtil', function() {
const tester = function() {
return false;
},
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [tester],
pp: function() {}
});
@@ -482,7 +482,7 @@ describe('matchersUtil', function() {
symmetricTester = function() {
return false;
},
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [symmetricTester()],
pp: function() {}
});
@@ -492,9 +492,9 @@ describe('matchersUtil', function() {
});
it('passes when an Any is compared to an Any that checks for the same type', function() {
const any1 = new jasmineUnderTest.Any(Function),
any2 = new jasmineUnderTest.Any(Function),
matchersUtil = new jasmineUnderTest.MatchersUtil();
const any1 = new privateUnderTest.Any(Function),
any2 = new privateUnderTest.Any(Function),
matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(any1, any2)).toBe(true);
});
@@ -502,7 +502,7 @@ describe('matchersUtil', function() {
it('passes for null prototype objects with same properties', function() {
const objA = Object.create(null),
objB = Object.create(null),
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
objA.name = 'test';
objB.name = 'test';
@@ -513,7 +513,7 @@ describe('matchersUtil', function() {
it('fails for null prototype objects with different properties', function() {
const objA = Object.create(null),
objB = Object.create(null),
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
objA.name = 'test';
objB.test = 'name';
@@ -522,12 +522,12 @@ describe('matchersUtil', function() {
});
it('passes when comparing two empty sets', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(new Set(), new Set())).toBe(true);
});
it('passes when comparing identical sets', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const setA = new Set();
setA.add(6);
setA.add(5);
@@ -539,7 +539,7 @@ describe('matchersUtil', function() {
});
it('passes when comparing identical sets with different insertion order and simple elements', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const setA = new Set();
setA.add(3);
setA.add(6);
@@ -551,7 +551,7 @@ describe('matchersUtil', function() {
});
it('passes when comparing identical sets with different insertion order and complex elements 1', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const setA1 = new Set();
setA1.add(['a', 3]);
setA1.add([6, 1]);
@@ -576,7 +576,7 @@ describe('matchersUtil', function() {
});
it('passes when comparing identical sets with different insertion order and complex elements 2', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const setA = new Set();
setA.add([[1, 2], [3, 4]]);
setA.add([[5, 6], [7, 8]]);
@@ -588,7 +588,7 @@ describe('matchersUtil', function() {
});
it('fails for sets with different elements', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const setA = new Set();
setA.add(6);
setA.add(3);
@@ -602,7 +602,7 @@ describe('matchersUtil', function() {
});
it('fails for sets of different size', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const setA = new Set();
setA.add(6);
setA.add(3);
@@ -615,12 +615,12 @@ describe('matchersUtil', function() {
});
it('passes when comparing two empty maps', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(new Map(), new Map())).toBe(true);
});
it('passes when comparing identical maps', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const mapA = new Map();
mapA.set(6, 5);
const mapB = new Map();
@@ -629,7 +629,7 @@ describe('matchersUtil', function() {
});
it('passes when comparing identical maps with different insertion order', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const mapA = new Map();
mapA.set('a', 3);
mapA.set(6, 1);
@@ -640,7 +640,7 @@ describe('matchersUtil', function() {
});
it('fails for maps with different elements', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const mapA = new Map();
mapA.set(6, 3);
mapA.set(5, 1);
@@ -652,7 +652,7 @@ describe('matchersUtil', function() {
});
it('fails for maps of different size', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const mapA = new Map();
mapA.set(6, 3);
const mapB = new Map();
@@ -662,7 +662,7 @@ describe('matchersUtil', function() {
});
it('passes when comparing two identical URLs', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(
matchersUtil.equals(
@@ -673,7 +673,7 @@ describe('matchersUtil', function() {
});
it('fails when comparing two different URLs', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil(),
const matchersUtil = new privateUnderTest.MatchersUtil(),
url1 = new URL('http://localhost/1');
expect(matchersUtil.equals(url1, new URL('http://localhost/2'))).toBe(
@@ -699,7 +699,7 @@ describe('matchersUtil', function() {
it('passes for ArrayBuffers with same length and content', function() {
const buffer1 = new ArrayBuffer(4);
const buffer2 = new ArrayBuffer(4);
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(buffer1, buffer2)).toBe(true);
});
@@ -708,13 +708,13 @@ describe('matchersUtil', function() {
const buffer2 = new ArrayBuffer(4);
const array1 = new Uint8Array(buffer1);
array1[0] = 1;
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.equals(buffer1, buffer2)).toBe(false);
});
describe('Typed arrays', function() {
it('fails for typed arrays of same length and contents but different types', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const a1 = new Int8Array(1);
const a2 = new Uint8Array(1);
a1[0] = a2[0] = 0;
@@ -737,23 +737,23 @@ describe('matchersUtil', function() {
it(
'passes for ' + typeName + 's with same length and content',
function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const a1 = new TypedArrayCtor(2);
const a2 = new TypedArrayCtor(2);
a1[0] = a2[0] = 0;
a1[1] = a2[1] = 1;
const diffBuilder = new jasmineUnderTest.DiffBuilder();
const diffBuilder = new privateUnderTest.DiffBuilder();
expect(matchersUtil.equals(a1, a2, diffBuilder)).toBe(true);
jasmine.debugLog('Diff: ' + diffBuilder.getMessage());
}
);
it('fails for ' + typeName + 's with different length', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const a1 = new TypedArrayCtor(2);
const a2 = new TypedArrayCtor(1);
a1[0] = a1[1] = a2[0] = 0;
const diffBuilder = new jasmineUnderTest.DiffBuilder();
const diffBuilder = new privateUnderTest.DiffBuilder();
expect(matchersUtil.equals(a1, a2, diffBuilder)).toBe(false);
jasmine.debugLog('Diff: ' + diffBuilder.getMessage());
});
@@ -761,24 +761,18 @@ describe('matchersUtil', function() {
it(
'fails for ' + typeName + 's with same length but different content',
function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const a1 = new TypedArrayCtor(1);
const a2 = new TypedArrayCtor(1);
a1[0] = 0;
a2[0] = 1;
const diffBuilder = new jasmineUnderTest.DiffBuilder();
const diffBuilder = new privateUnderTest.DiffBuilder();
expect(matchersUtil.equals(a1, a2, diffBuilder)).toBe(false);
jasmine.debugLog(
'a1 keys: ' +
jasmine.basicPrettyPrinter_(
jasmineUnderTest.MatchersUtil.keys(a1)
)
'a1 keys: ' + jasmine.pp(privateUnderTest.MatchersUtil.keys(a1))
);
jasmine.debugLog(
'a2 keys: ' +
jasmine.basicPrettyPrinter_(
jasmineUnderTest.MatchersUtil.keys(a2)
)
'a2 keys: ' + jasmine.pp(privateUnderTest.MatchersUtil.keys(a2))
);
jasmine.debugLog('a1 length:' + a1.length);
jasmine.debugLog('a2 length:' + a2.length);
@@ -788,7 +782,7 @@ describe('matchersUtil', function() {
);
it('checks nonstandard properties of ' + typeName, function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const a1 = new TypedArrayCtor(1);
const a2 = new TypedArrayCtor(1);
a1[0] = a2[0] = 0;
@@ -799,7 +793,7 @@ describe('matchersUtil', function() {
it('works with custom equality testers with ' + typeName, function() {
const a1 = new TypedArrayCtor(1);
const a2 = new TypedArrayCtor(1);
const matchersUtil = new jasmineUnderTest.MatchersUtil({
const matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [
function() {
return true;
@@ -827,7 +821,7 @@ describe('matchersUtil', function() {
'passes for ' + typeName + 's with same length and content',
function() {
const TypedArrayCtor = requireType();
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const a1 = new TypedArrayCtor(2);
const a2 = new TypedArrayCtor(2);
a1[0] = a2[0] = BigInt(0);
@@ -838,7 +832,7 @@ describe('matchersUtil', function() {
it('fails for ' + typeName + 's with different length', function() {
const TypedArrayCtor = requireType();
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const a1 = new TypedArrayCtor(2);
const a2 = new TypedArrayCtor(1);
a1[0] = a1[1] = a2[0] = BigInt(0);
@@ -849,7 +843,7 @@ describe('matchersUtil', function() {
'fails for ' + typeName + 's with same length but different content',
function() {
const TypedArrayCtor = requireType();
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const a1 = new TypedArrayCtor(2);
const a2 = new TypedArrayCtor(2);
a1[0] = a1[1] = a2[0] = BigInt(0);
@@ -937,7 +931,7 @@ describe('matchersUtil', function() {
'withPath',
'setRoots'
]),
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
diffBuilder.withPath.and.callFake(function(p, block) {
block();
@@ -965,7 +959,7 @@ describe('matchersUtil', function() {
'withPath',
'setRoots'
]),
matchersUtil = new jasmineUnderTest.MatchersUtil();
matchersUtil = new privateUnderTest.MatchersUtil();
diffBuilder.withPath.and.callFake(function(p, block) {
block();
@@ -982,8 +976,8 @@ describe('matchersUtil', function() {
});
it('uses a diffBuilder if one is provided as the third argument', function() {
const diffBuilder = new jasmineUnderTest.DiffBuilder(),
matchersUtil = new jasmineUnderTest.MatchersUtil();
const diffBuilder = new privateUnderTest.DiffBuilder(),
matchersUtil = new privateUnderTest.MatchersUtil();
spyOn(diffBuilder, 'recordMismatch');
spyOn(diffBuilder, 'withPath').and.callThrough();
@@ -1003,27 +997,27 @@ describe('matchersUtil', function() {
describe('contains', function() {
it('passes when expected is a substring of actual', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.contains('ABC', 'BC')).toBe(true);
});
it('fails when expected is a not substring of actual', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.contains('ABC', 'X')).toBe(false);
});
it('passes when expected is an element in an actual array', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.contains(['foo', 'bar'], 'foo')).toBe(true);
});
it('fails when expected is not an element in an actual array', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.contains(['foo', 'bar'], 'baz')).toBe(false);
});
it('passes with mixed-element arrays', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.contains(['foo', { some: 'bar' }], 'foo')).toBe(true);
expect(
matchersUtil.contains(['foo', { some: 'bar' }], { some: 'bar' })
@@ -1034,7 +1028,7 @@ describe('matchersUtil', function() {
const customTester = function() {
return true;
},
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [customTester],
pp: function() {}
});
@@ -1043,18 +1037,18 @@ describe('matchersUtil', function() {
});
it('fails when actual is undefined', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.contains(undefined, 'A')).toBe(false);
});
it('fails when actual is null', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.contains(null, 'A')).toBe(false);
});
it('works with array-like objects that implement iterable', function() {
let capturedArgs = null;
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
function testFunction() {
capturedArgs = arguments;
@@ -1071,14 +1065,14 @@ describe('matchersUtil', function() {
1: 'b',
length: 2
};
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(matchersUtil.contains(arrayLike, 'b')).toBe(true);
expect(matchersUtil.contains(arrayLike, 'c')).toBe(false);
});
it('passes for set members', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const setItem = { foo: 'bar' };
const set = new Set();
set.add(setItem);
@@ -1087,7 +1081,7 @@ describe('matchersUtil', function() {
});
it('passes for objects that equal to a set member', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
const set = new Set();
set.add({ foo: 'bar' });
@@ -1099,8 +1093,8 @@ describe('matchersUtil', function() {
it('builds an English sentence for a failure case', function() {
const actual = 'foo',
name = 'toBar',
pp = jasmineUnderTest.makePrettyPrinter(),
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: pp }),
pp = privateUnderTest.makePrettyPrinter(),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: pp }),
message = matchersUtil.buildFailureMessage(name, false, actual);
expect(message).toEqual("Expected 'foo' to bar.");
@@ -1110,8 +1104,8 @@ describe('matchersUtil', function() {
const actual = 'foo',
name = 'toBar',
isNot = true,
pp = jasmineUnderTest.makePrettyPrinter(),
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: pp }),
pp = privateUnderTest.makePrettyPrinter(),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: pp }),
message = matchersUtil.buildFailureMessage(name, isNot, actual);
expect(message).toEqual("Expected 'foo' not to bar.");
@@ -1120,8 +1114,8 @@ describe('matchersUtil', function() {
it('builds an English sentence for an arbitrary array of expected arguments', function() {
const actual = 'foo',
name = 'toBar',
pp = jasmineUnderTest.makePrettyPrinter(),
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: pp }),
pp = privateUnderTest.makePrettyPrinter(),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: pp }),
message = matchersUtil.buildFailureMessage(
name,
false,
@@ -1142,7 +1136,7 @@ describe('matchersUtil', function() {
pp = function(value) {
return '<' + value + '>';
},
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: pp }),
message = matchersUtil.buildFailureMessage(
name,
isNot,

View File

@@ -1,6 +1,6 @@
describe('nothing', function() {
it('should pass', function() {
const matcher = jasmineUnderTest.matchers.nothing(),
const matcher = privateUnderTest.matchers.nothing(),
result = matcher.compare();
expect(result.pass).toBe(true);

View File

@@ -1,6 +1,6 @@
describe('toBeCloseTo', function() {
it('passes when within two decimal places by default', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
let result;
result = matcher.compare(0, 0);
@@ -14,7 +14,7 @@ describe('toBeCloseTo', function() {
});
it('fails when not within two decimal places by default', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
let result;
result = matcher.compare(0, 0.01);
@@ -25,7 +25,7 @@ describe('toBeCloseTo', function() {
});
it('accepts an optional precision argument', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
let result;
result = matcher.compare(0, 0.1, 0);
@@ -48,7 +48,7 @@ describe('toBeCloseTo', function() {
});
it('fails when one of the arguments is null', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
expect(function() {
matcher.compare(null, null);
@@ -70,7 +70,7 @@ describe('toBeCloseTo', function() {
});
it('rounds expected values', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
let result;
result = matcher.compare(1.23, 1.229);
@@ -98,7 +98,7 @@ describe('toBeCloseTo', function() {
});
it('handles edge cases with rounding', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
let result;
// these cases resulted in false negatives in version of V8
@@ -113,37 +113,37 @@ describe('toBeCloseTo', function() {
describe('Infinity handling', function() {
it('passes when the actual and expected are both Infinity', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
const result = matcher.compare(Infinity, Infinity, 0);
expect(result.pass).toBe(true);
});
it('passes when the actual and expected are both -Infinity', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
const result = matcher.compare(-Infinity, -Infinity, 0);
expect(result.pass).toBe(true);
});
it('fails when the actual is Infinity and the expected is -Infinity', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
const result = matcher.compare(Infinity, -Infinity, 0);
expect(result.pass).toBe(false);
});
it('fails when the actual is -Infinity and the expected is Infinity', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
const result = matcher.compare(-Infinity, Infinity, 0);
expect(result.pass).toBe(false);
});
it('fails when the actual is a number and the expected is Infinity', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
const result = matcher.compare(42, Infinity, 0);
expect(result.pass).toBe(false);
});
it('fails when the actual is a number and the expected is -Infinity', function() {
const matcher = jasmineUnderTest.matchers.toBeCloseTo();
const matcher = privateUnderTest.matchers.toBeCloseTo();
const result = matcher.compare(42, -Infinity, 0);
expect(result.pass).toBe(false);
});

View File

@@ -1,12 +1,12 @@
describe('toBeDefined', function() {
it('matches for defined values', function() {
const matcher = jasmineUnderTest.matchers.toBeDefined();
const matcher = privateUnderTest.matchers.toBeDefined();
const result = matcher.compare('foo');
expect(result.pass).toBe(true);
});
it('fails when matching undefined values', function() {
const matcher = jasmineUnderTest.matchers.toBeDefined();
const matcher = privateUnderTest.matchers.toBeDefined();
const result = matcher.compare(void 0);
expect(result.pass).toBe(false);
});

View File

@@ -1,18 +1,18 @@
describe('toBeFalse', function() {
it('passes for false', function() {
const matcher = jasmineUnderTest.matchers.toBeFalse();
const matcher = privateUnderTest.matchers.toBeFalse();
const result = matcher.compare(false);
expect(result.pass).toBe(true);
});
it('fails for non-false', function() {
const matcher = jasmineUnderTest.matchers.toBeFalse();
const matcher = privateUnderTest.matchers.toBeFalse();
const result = matcher.compare('foo');
expect(result.pass).toBe(false);
});
it('fails for falsy', function() {
const matcher = jasmineUnderTest.matchers.toBeFalse();
const matcher = privateUnderTest.matchers.toBeFalse();
const result = matcher.compare(undefined);
expect(result.pass).toBe(false);
});

View File

@@ -1,6 +1,6 @@
describe('toBeFalsy', function() {
it("passes for 'falsy' values", function() {
const matcher = jasmineUnderTest.matchers.toBeFalsy();
const matcher = privateUnderTest.matchers.toBeFalsy();
let result;
result = matcher.compare(false);
@@ -23,7 +23,7 @@ describe('toBeFalsy', function() {
});
it("fails for 'truthy' values", function() {
const matcher = jasmineUnderTest.matchers.toBeFalsy();
const matcher = privateUnderTest.matchers.toBeFalsy();
let result;
result = matcher.compare(true);

View File

@@ -1,6 +1,6 @@
describe('toBeGreaterThanOrEqual', function() {
it('passes when actual >= expected', function() {
const matcher = jasmineUnderTest.matchers.toBeGreaterThanOrEqual();
const matcher = privateUnderTest.matchers.toBeGreaterThanOrEqual();
let result;
result = matcher.compare(2, 1);
@@ -17,7 +17,7 @@ describe('toBeGreaterThanOrEqual', function() {
});
it('fails when actual < expected', function() {
const matcher = jasmineUnderTest.matchers.toBeGreaterThanOrEqual();
const matcher = privateUnderTest.matchers.toBeGreaterThanOrEqual();
let result;
result = matcher.compare(1, 2);

View File

@@ -1,12 +1,12 @@
describe('toBeGreaterThan', function() {
it('passes when actual > expected', function() {
const matcher = jasmineUnderTest.matchers.toBeGreaterThan();
const matcher = privateUnderTest.matchers.toBeGreaterThan();
const result = matcher.compare(2, 1);
expect(result.pass).toBe(true);
});
it('fails when actual <= expected', function() {
const matcher = jasmineUnderTest.matchers.toBeGreaterThan();
const matcher = privateUnderTest.matchers.toBeGreaterThan();
let result;
result = matcher.compare(1, 1);

View File

@@ -1,7 +1,7 @@
describe('toBeInstanceOf', function() {
describe('when expecting Number', function() {
it('passes for literal number', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(3, Number);
expect(result).toEqual({
pass: true,
@@ -10,8 +10,8 @@ describe('toBeInstanceOf', function() {
});
it('passes for NaN', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toBeInstanceOf({
pp: privateUnderTest.makePrettyPrinter()
});
const result = matcher.compare(NaN, Number);
expect(result).toEqual({
@@ -21,7 +21,7 @@ describe('toBeInstanceOf', function() {
});
it('passes for Infinity', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(Infinity, Number);
expect(result).toEqual({
pass: true,
@@ -30,7 +30,7 @@ describe('toBeInstanceOf', function() {
});
it('fails for a non-number', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare('foo', Number);
expect(result).toEqual({
pass: false,
@@ -41,7 +41,7 @@ describe('toBeInstanceOf', function() {
describe('when expecting String', function() {
it('passes for a string', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare('foo', String);
expect(result).toEqual({
pass: true,
@@ -50,7 +50,7 @@ describe('toBeInstanceOf', function() {
});
it('fails for a non-string', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare({}, String);
expect(result).toEqual({
pass: false,
@@ -61,7 +61,7 @@ describe('toBeInstanceOf', function() {
describe('when expecting Boolean', function() {
it('passes for a boolean', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(true, Boolean);
expect(result).toEqual({
pass: true,
@@ -70,7 +70,7 @@ describe('toBeInstanceOf', function() {
});
it('fails for a non-boolean', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare('false', Boolean);
expect(result).toEqual({
pass: false,
@@ -81,7 +81,7 @@ describe('toBeInstanceOf', function() {
describe('when expecting RegExp', function() {
it('passes for a literal regular expression', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(/foo/, RegExp);
expect(result).toEqual({
pass: true,
@@ -94,7 +94,7 @@ describe('toBeInstanceOf', function() {
it('passes for a function', function() {
const fn = function() {};
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(fn, Function);
expect(result).toEqual({
pass: true,
@@ -108,7 +108,7 @@ describe('toBeInstanceOf', function() {
return 'foo';
}
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(fn, Function);
expect(result).toEqual({
pass: true,
@@ -122,7 +122,7 @@ describe('toBeInstanceOf', function() {
function Animal() {}
it('passes for any object', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare({ foo: 'bar' }, Object);
expect(result).toEqual({
pass: true,
@@ -131,7 +131,7 @@ describe('toBeInstanceOf', function() {
});
it('passes for an Error object', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(new Error('example'), Object);
expect(result).toEqual({
pass: true,
@@ -140,7 +140,7 @@ describe('toBeInstanceOf', function() {
});
it('passes for a user-defined class', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(new Animal(), Object);
expect(result).toEqual({
pass: true,
@@ -149,7 +149,7 @@ describe('toBeInstanceOf', function() {
});
it('fails for a non-object', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare('foo', Object);
expect(result).toEqual({
pass: false,
@@ -160,8 +160,8 @@ describe('toBeInstanceOf', function() {
it('passes for objects with no constructor', function() {
const object = Object.create(null);
const matcher = jasmineUnderTest.matchers.toBeInstanceOf({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toBeInstanceOf({
pp: privateUnderTest.makePrettyPrinter()
});
const result = matcher.compare(object, Object);
expect(result).toEqual({
@@ -190,7 +190,7 @@ describe('toBeInstanceOf', function() {
Cat.prototype.constructor = Cat;
it('passes for instances of that class', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(new Animal(), Animal);
expect(result).toEqual({
pass: true,
@@ -199,7 +199,7 @@ describe('toBeInstanceOf', function() {
});
it('passes for instances of a subclass', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(new Cat(), Animal);
expect(result).toEqual({
pass: true,
@@ -208,7 +208,7 @@ describe('toBeInstanceOf', function() {
});
it('does not pass for sibling classes', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
const result = matcher.compare(new Dog(), Cat);
expect(result).toEqual({
pass: false,
@@ -218,7 +218,7 @@ describe('toBeInstanceOf', function() {
});
it('raises an error if passed an invalid expected value', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf();
const matcher = privateUnderTest.matchers.toBeInstanceOf();
expect(function() {
matcher.compare({}, 'Error');
}).toThrowError(
@@ -228,8 +228,8 @@ describe('toBeInstanceOf', function() {
});
it('raises an error if missing an expected value', function() {
const matcher = jasmineUnderTest.matchers.toBeInstanceOf({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toBeInstanceOf({
pp: privateUnderTest.makePrettyPrinter()
});
expect(function() {
matcher.compare({}, undefined);

View File

@@ -1,6 +1,6 @@
describe('toBeLessThanOrEqual', function() {
it('passes when actual <= expected', function() {
const matcher = jasmineUnderTest.matchers.toBeLessThanOrEqual();
const matcher = privateUnderTest.matchers.toBeLessThanOrEqual();
let result;
result = matcher.compare(1, 2);
@@ -17,7 +17,7 @@ describe('toBeLessThanOrEqual', function() {
});
it('fails when actual < expected', function() {
const matcher = jasmineUnderTest.matchers.toBeLessThanOrEqual();
const matcher = privateUnderTest.matchers.toBeLessThanOrEqual();
let result;
result = matcher.compare(2, 1);

View File

@@ -1,12 +1,12 @@
describe('toBeLessThan', function() {
it('passes when actual < expected', function() {
const matcher = jasmineUnderTest.matchers.toBeLessThan();
const matcher = privateUnderTest.matchers.toBeLessThan();
const result = matcher.compare(1, 2);
expect(result.pass).toBe(true);
});
it('fails when actual <= expected', function() {
const matcher = jasmineUnderTest.matchers.toBeLessThan();
const matcher = privateUnderTest.matchers.toBeLessThan();
let result;
result = matcher.compare(1, 1);

View File

@@ -1,13 +1,13 @@
describe('toBeNaN', function() {
it('passes for NaN with a custom .not fail', function() {
const matcher = jasmineUnderTest.matchers.toBeNaN();
const matcher = privateUnderTest.matchers.toBeNaN();
const result = matcher.compare(Number.NaN);
expect(result.pass).toBe(true);
expect(result.message).toEqual('Expected actual not to be NaN.');
});
it('fails for anything not a NaN', function() {
const matcher = jasmineUnderTest.matchers.toBeNaN();
const matcher = privateUnderTest.matchers.toBeNaN();
let result;
result = matcher.compare(1);
@@ -27,8 +27,8 @@ describe('toBeNaN', function() {
});
it('has a custom message on failure', function() {
const matcher = jasmineUnderTest.matchers.toBeNaN({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toBeNaN({
pp: privateUnderTest.makePrettyPrinter()
}),
result = matcher.compare(0);

View File

@@ -1,6 +1,6 @@
describe('toBeNegativeInfinity', function() {
it("fails for anything that isn't -Infinity", function() {
const matcher = jasmineUnderTest.matchers.toBeNegativeInfinity();
const matcher = privateUnderTest.matchers.toBeNegativeInfinity();
let result;
result = matcher.compare(1);
@@ -14,8 +14,8 @@ describe('toBeNegativeInfinity', function() {
});
it('has a custom message on failure', function() {
const matcher = jasmineUnderTest.matchers.toBeNegativeInfinity({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toBeNegativeInfinity({
pp: privateUnderTest.makePrettyPrinter()
}),
result = matcher.compare(0);
@@ -23,7 +23,7 @@ describe('toBeNegativeInfinity', function() {
});
it('succeeds for -Infinity', function() {
const matcher = jasmineUnderTest.matchers.toBeNegativeInfinity(),
const matcher = privateUnderTest.matchers.toBeNegativeInfinity(),
result = matcher.compare(Number.NEGATIVE_INFINITY);
expect(result.pass).toBe(true);

View File

@@ -1,12 +1,12 @@
describe('toBeNull', function() {
it('passes for null', function() {
const matcher = jasmineUnderTest.matchers.toBeNull();
const matcher = privateUnderTest.matchers.toBeNull();
const result = matcher.compare(null);
expect(result.pass).toBe(true);
});
it('fails for non-null', function() {
const matcher = jasmineUnderTest.matchers.toBeNull();
const matcher = privateUnderTest.matchers.toBeNull();
const result = matcher.compare('foo');
expect(result.pass).toBe(false);
});

View File

@@ -1,55 +1,55 @@
describe('toBeNullish', function() {
it('passes for null values', function() {
const matcher = jasmineUnderTest.matchers.toBeNullish();
const matcher = privateUnderTest.matchers.toBeNullish();
const result = matcher.compare(null);
expect(result.pass).toBe(true);
});
it('passes for undefined values', function() {
const matcher = jasmineUnderTest.matchers.toBeNullish();
const matcher = privateUnderTest.matchers.toBeNullish();
const result = matcher.compare(void 0);
expect(result.pass).toBe(true);
});
it('fails when matching defined values', function() {
const matcher = jasmineUnderTest.matchers.toBeNullish();
const matcher = privateUnderTest.matchers.toBeNullish();
const result = matcher.compare('foo');
expect(result.pass).toBe(false);
});
describe('falsy values', () => {
it('fails for 0', function() {
const matcher = jasmineUnderTest.matchers.toBeNullish();
const matcher = privateUnderTest.matchers.toBeNullish();
const result = matcher.compare(0);
expect(result.pass).toBe(false);
});
it('fails for -0', function() {
const matcher = jasmineUnderTest.matchers.toBeNullish();
const matcher = privateUnderTest.matchers.toBeNullish();
const result = matcher.compare(-0);
expect(result.pass).toBe(false);
});
it('fails for empty string', function() {
const matcher = jasmineUnderTest.matchers.toBeNullish();
const matcher = privateUnderTest.matchers.toBeNullish();
const result = matcher.compare('');
expect(result.pass).toBe(false);
});
it('fails for false', function() {
const matcher = jasmineUnderTest.matchers.toBeNullish();
const matcher = privateUnderTest.matchers.toBeNullish();
const result = matcher.compare(false);
expect(result.pass).toBe(false);
});
it('fails for NaN', function() {
const matcher = jasmineUnderTest.matchers.toBeNullish();
const matcher = privateUnderTest.matchers.toBeNullish();
const result = matcher.compare(NaN);
expect(result.pass).toBe(false);
});
it('fails for 0n', function() {
const matcher = jasmineUnderTest.matchers.toBeNullish();
const matcher = privateUnderTest.matchers.toBeNullish();
const result = matcher.compare(BigInt(0));
expect(result.pass).toBe(false);
});

View File

@@ -1,6 +1,6 @@
describe('toBePositiveInfinity', function() {
it("fails for anything that isn't Infinity", function() {
const matcher = jasmineUnderTest.matchers.toBePositiveInfinity();
const matcher = privateUnderTest.matchers.toBePositiveInfinity();
let result;
result = matcher.compare(1);
@@ -14,8 +14,8 @@ describe('toBePositiveInfinity', function() {
});
it('has a custom message on failure', function() {
const matcher = jasmineUnderTest.matchers.toBePositiveInfinity({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toBePositiveInfinity({
pp: privateUnderTest.makePrettyPrinter()
}),
result = matcher.compare(0);
@@ -23,7 +23,7 @@ describe('toBePositiveInfinity', function() {
});
it('succeeds for Infinity', function() {
const matcher = jasmineUnderTest.matchers.toBePositiveInfinity(),
const matcher = privateUnderTest.matchers.toBePositiveInfinity(),
result = matcher.compare(Number.POSITIVE_INFINITY);
expect(result.pass).toBe(true);

View File

@@ -1,16 +1,16 @@
describe('toBe', function() {
it('passes with no message when actual === expected', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.matchers.toBe(matchersUtil),
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.matchers.toBe(matchersUtil),
result = matcher.compare(1, 1);
expect(result.pass).toBe(true);
});
it('passes with a custom message when expected is an array', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.matchers.toBe(matchersUtil),
matcher = privateUnderTest.matchers.toBe(matchersUtil),
array = [1];
const result = matcher.compare(array, array);
@@ -21,10 +21,10 @@ describe('toBe', function() {
});
it('passes with a custom message when expected is an object', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.matchers.toBe(matchersUtil),
matcher = privateUnderTest.matchers.toBe(matchersUtil),
obj = { foo: 'bar' };
const result = matcher.compare(obj, obj);
@@ -35,18 +35,18 @@ describe('toBe', function() {
});
it('fails with no message when actual !== expected', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil(),
matcher = jasmineUnderTest.matchers.toBe(matchersUtil),
const matchersUtil = new privateUnderTest.MatchersUtil(),
matcher = privateUnderTest.matchers.toBe(matchersUtil),
result = matcher.compare(1, 2);
expect(result.pass).toBe(false);
expect(result.message).toBeUndefined();
});
it('fails with a custom message when expected is an array', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.matchers.toBe(matchersUtil),
matcher = privateUnderTest.matchers.toBe(matchersUtil),
result = matcher.compare([1], [1]);
expect(result.pass).toBe(false);
@@ -56,10 +56,10 @@ describe('toBe', function() {
});
it('fails with a custom message when expected is an object', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.matchers.toBe(matchersUtil),
matcher = privateUnderTest.matchers.toBe(matchersUtil),
result = matcher.compare({ foo: 'bar' }, { foo: 'bar' });
expect(result.pass).toBe(false);
@@ -72,9 +72,9 @@ describe('toBe', function() {
const formatter = function(x) {
return '<' + x.foo + '>';
},
prettyPrinter = jasmineUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: prettyPrinter }),
matcher = jasmineUnderTest.matchers.toBe(matchersUtil),
prettyPrinter = privateUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: prettyPrinter }),
matcher = privateUnderTest.matchers.toBe(matchersUtil),
result = matcher.compare({ foo: 'bar' }, { foo: 'bar' });
expect(result.pass).toBe(false);

View File

@@ -1,12 +1,12 @@
describe('toBeTrue', function() {
it('passes for true', function() {
const matcher = jasmineUnderTest.matchers.toBeTrue();
const matcher = privateUnderTest.matchers.toBeTrue();
const result = matcher.compare(true);
expect(result.pass).toBe(true);
});
it('fails for non-true', function() {
const matcher = jasmineUnderTest.matchers.toBeTrue();
const matcher = privateUnderTest.matchers.toBeTrue();
const result = matcher.compare('foo');
expect(result.pass).toBe(false);
});

View File

@@ -1,6 +1,6 @@
describe('toBeTruthy', function() {
it("passes for 'truthy' values", function() {
const matcher = jasmineUnderTest.matchers.toBeTruthy();
const matcher = privateUnderTest.matchers.toBeTruthy();
let result;
result = matcher.compare(true);
@@ -23,7 +23,7 @@ describe('toBeTruthy', function() {
});
it("fails for 'falsy' values", function() {
const matcher = jasmineUnderTest.matchers.toBeTruthy();
const matcher = privateUnderTest.matchers.toBeTruthy();
let result;
result = matcher.compare(false);

View File

@@ -1,12 +1,12 @@
describe('toBeUndefined', function() {
it('passes for undefined values', function() {
const matcher = jasmineUnderTest.matchers.toBeUndefined();
const matcher = privateUnderTest.matchers.toBeUndefined();
const result = matcher.compare(void 0);
expect(result.pass).toBe(true);
});
it('fails when matching defined values', function() {
const matcher = jasmineUnderTest.matchers.toBeUndefined();
const matcher = privateUnderTest.matchers.toBeUndefined();
const result = matcher.compare('foo');
expect(result.pass).toBe(false);
});

View File

@@ -1,9 +1,9 @@
describe('toContain', function() {
it('delegates to jasmineUnderTest.matchersUtil.contains', function() {
it('delegates to privateUnderTest.MatchersUtil.contains', function() {
const matchersUtil = {
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
},
matcher = jasmineUnderTest.matchers.toContain(matchersUtil);
matcher = privateUnderTest.matchers.toContain(matchersUtil);
const result = matcher.compare('ABC', 'B');
expect(matchersUtil.contains).toHaveBeenCalledWith('ABC', 'B');
@@ -14,10 +14,10 @@ describe('toContain', function() {
const tester = function(a, b) {
return a.toString() === b.toString();
},
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [tester]
}),
matcher = jasmineUnderTest.matchers.toContain(matchersUtil);
matcher = privateUnderTest.matchers.toContain(matchersUtil);
const result = matcher.compare(['1', '2'], 2);
expect(result.pass).toBe(true);

View File

@@ -2,10 +2,10 @@ describe('toEqual', function() {
'use strict';
function compareEquals(actual, expected) {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.matchers.toEqual(matchersUtil);
matcher = privateUnderTest.matchers.toEqual(matchersUtil);
const result = matcher.compare(actual, expected);
@@ -18,9 +18,9 @@ describe('toEqual', function() {
buildFailureMessage: function() {
return 'does not matter';
},
DiffBuilder: new jasmineUnderTest.DiffBuilder()
DiffBuilder: new privateUnderTest.DiffBuilder()
},
matcher = jasmineUnderTest.matchers.toEqual(matchersUtil);
matcher = privateUnderTest.matchers.toEqual(matchersUtil);
const result = matcher.compare(1, 1);
@@ -32,10 +32,10 @@ describe('toEqual', function() {
const tester = function(a, b) {
return a.toString() === b.toString();
},
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [tester]
}),
matcher = jasmineUnderTest.matchers.toEqual(matchersUtil);
matcher = privateUnderTest.matchers.toEqual(matchersUtil);
const result = matcher.compare(1, '1');
@@ -148,9 +148,9 @@ describe('toEqual', function() {
const actual = { x: { y: 1, z: 2, f: 4 } },
expected = { x: { y: 1, z: 2, g: 3 } },
pp = jasmineUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toEqual(matchersUtil),
pp = privateUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toEqual(matchersUtil),
message =
'Expected $.x to have properties\n' +
' g: |3|\n' +
@@ -169,9 +169,9 @@ describe('toEqual', function() {
const actual = [{ foo: 4 }],
expected = [{ foo: 5 }],
prettyPrinter = jasmineUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: prettyPrinter }),
matcher = jasmineUnderTest.matchers.toEqual(matchersUtil),
prettyPrinter = privateUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: prettyPrinter }),
matcher = privateUnderTest.matchers.toEqual(matchersUtil),
message = 'Expected $[0].foo = |4| to equal |5|.';
expect(matcher.compare(actual, expected).message).toEqual(message);
@@ -196,9 +196,9 @@ describe('toEqual', function() {
bar: "shouldn't be pretty printed"
}
],
prettyPrinter = jasmineUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: prettyPrinter }),
matcher = jasmineUnderTest.matchers.toEqual(matchersUtil),
prettyPrinter = privateUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: prettyPrinter }),
matcher = privateUnderTest.matchers.toEqual(matchersUtil),
message =
'Expected $[0].foo = [thing with a=1, b=2] to equal [thing with a=5, b=2].\n' +
"Expected $[0].bar = 'should not be pretty printed' to equal 'shouldn't be pretty printed'.";
@@ -390,9 +390,9 @@ describe('toEqual', function() {
const actual = { x: new Foo() },
expected = { x: new Bar() },
message = 'Expected $.x to be a kind of Bar, but was |[object Object]|.',
pp = jasmineUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toEqual(matchersUtil);
pp = privateUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toEqual(matchersUtil);
expect(matcher.compare(actual, expected).message).toEqual(message);
});
@@ -939,9 +939,9 @@ describe('toEqual', function() {
const actual = [1, 1, 2, 3, 5],
expected = [1, 1, 2, 3],
pp = jasmineUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toEqual(matchersUtil),
pp = privateUnderTest.makePrettyPrinter([formatter]),
matchersUtil = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toEqual(matchersUtil),
message =
'Expected $.length = |5| to equal |4|.\n' +
'Unexpected $[4] = |5| in array.';

View File

@@ -1,10 +1,10 @@
describe('toHaveBeenCalledBefore', function() {
it('throws an exception when the actual is not a spy', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledBefore({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toHaveBeenCalledBefore({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {},
spy = new jasmineUnderTest.Env().createSpy('a spy');
spy = new privateUnderTest.Env().createSpy('a spy');
expect(function() {
matcher.compare(fn, spy);
@@ -12,10 +12,10 @@ describe('toHaveBeenCalledBefore', function() {
});
it('throws an exception when the expected is not a spy', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledBefore({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toHaveBeenCalledBefore({
pp: privateUnderTest.makePrettyPrinter()
}),
spy = new jasmineUnderTest.Env().createSpy('a spy'),
spy = new privateUnderTest.Env().createSpy('a spy'),
fn = function() {};
expect(function() {
@@ -24,9 +24,9 @@ describe('toHaveBeenCalledBefore', function() {
});
it('fails when the actual was not called', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new jasmineUnderTest.Spy('first spy'),
secondSpy = new jasmineUnderTest.Spy('second spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new privateUnderTest.Spy('first spy'),
secondSpy = new privateUnderTest.Spy('second spy');
secondSpy();
@@ -38,9 +38,9 @@ describe('toHaveBeenCalledBefore', function() {
});
it('fails when the expected was not called', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new jasmineUnderTest.Spy('first spy'),
secondSpy = new jasmineUnderTest.Spy('second spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new privateUnderTest.Spy('first spy'),
secondSpy = new privateUnderTest.Spy('second spy');
firstSpy();
@@ -52,9 +52,9 @@ describe('toHaveBeenCalledBefore', function() {
});
it('fails when the actual is called after the expected', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new jasmineUnderTest.Spy('first spy'),
secondSpy = new jasmineUnderTest.Spy('second spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new privateUnderTest.Spy('first spy'),
secondSpy = new privateUnderTest.Spy('second spy');
secondSpy();
firstSpy();
@@ -67,9 +67,9 @@ describe('toHaveBeenCalledBefore', function() {
});
it('fails when the actual is called before and after the expected', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new jasmineUnderTest.Spy('first spy'),
secondSpy = new jasmineUnderTest.Spy('second spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new privateUnderTest.Spy('first spy'),
secondSpy = new privateUnderTest.Spy('second spy');
firstSpy();
secondSpy();
@@ -83,9 +83,9 @@ describe('toHaveBeenCalledBefore', function() {
});
it('fails when the expected is called before and after the actual', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new jasmineUnderTest.Spy('first spy'),
secondSpy = new jasmineUnderTest.Spy('second spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new privateUnderTest.Spy('first spy'),
secondSpy = new privateUnderTest.Spy('second spy');
secondSpy();
firstSpy();
@@ -99,9 +99,9 @@ describe('toHaveBeenCalledBefore', function() {
});
it('passes when the actual is called before the expected', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new jasmineUnderTest.Spy('first spy'),
secondSpy = new jasmineUnderTest.Spy('second spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new privateUnderTest.Spy('first spy'),
secondSpy = new privateUnderTest.Spy('second spy');
firstSpy();
secondSpy();
@@ -114,9 +114,9 @@ describe('toHaveBeenCalledBefore', function() {
});
it('set the correct calls as verified when passing', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new jasmineUnderTest.Spy('first spy'),
secondSpy = new jasmineUnderTest.Spy('second spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledBefore(),
firstSpy = new privateUnderTest.Spy('first spy'),
secondSpy = new privateUnderTest.Spy('second spy');
firstSpy();
secondSpy();

View File

@@ -1,9 +1,9 @@
describe('toHaveBeenCalledOnceWith', function() {
it('passes when the actual was called only once and with matching parameters', function() {
const pp = jasmineUnderTest.makePrettyPrinter(),
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new jasmineUnderTest.Spy('called-spy');
const pp = privateUnderTest.makePrettyPrinter(),
util = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy('a', 'b');
const result = matcher.compare(calledSpy, 'a', 'b');
@@ -20,13 +20,13 @@ describe('toHaveBeenCalledOnceWith', function() {
return true;
}
],
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: customEqualityTesters
}),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(
matcher = privateUnderTest.matchers.toHaveBeenCalledOnceWith(
matchersUtil
),
calledSpy = new jasmineUnderTest.Spy('called-spy');
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy('a', 'b');
const result = matcher.compare(calledSpy, 'a', 'a');
@@ -35,10 +35,10 @@ describe('toHaveBeenCalledOnceWith', function() {
});
it('fails when the actual was never called', function() {
const pp = jasmineUnderTest.makePrettyPrinter(),
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new jasmineUnderTest.Spy('called-spy');
const pp = privateUnderTest.makePrettyPrinter(),
util = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new privateUnderTest.Spy('called-spy');
const result = matcher.compare(calledSpy, 'a', 'b');
@@ -49,10 +49,10 @@ describe('toHaveBeenCalledOnceWith', function() {
});
it('fails when the actual was called once with different parameters', function() {
const pp = jasmineUnderTest.makePrettyPrinter(),
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new jasmineUnderTest.Spy('called-spy');
const pp = privateUnderTest.makePrettyPrinter(),
util = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy('a', 'c');
const result = matcher.compare(calledSpy, 'a', 'b');
@@ -64,10 +64,10 @@ describe('toHaveBeenCalledOnceWith', function() {
});
it('fails when the actual was called multiple times with expected parameters', function() {
const pp = jasmineUnderTest.makePrettyPrinter(),
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new jasmineUnderTest.Spy('called-spy');
const pp = privateUnderTest.makePrettyPrinter(),
util = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy('a', 'b');
calledSpy('a', 'b');
@@ -80,10 +80,10 @@ describe('toHaveBeenCalledOnceWith', function() {
});
it('fails when the actual was called multiple times (one of them - with expected parameters)', function() {
const pp = jasmineUnderTest.makePrettyPrinter(),
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new jasmineUnderTest.Spy('called-spy');
const pp = privateUnderTest.makePrettyPrinter(),
util = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy('a', 'b');
calledSpy('a', 'c');
@@ -96,9 +96,9 @@ describe('toHaveBeenCalledOnceWith', function() {
});
it('throws an exception when the actual is not a spy', function() {
const pp = jasmineUnderTest.makePrettyPrinter(),
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
const pp = privateUnderTest.makePrettyPrinter(),
util = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toHaveBeenCalledOnceWith(util),
fn = function() {};
expect(function() {
@@ -107,10 +107,10 @@ describe('toHaveBeenCalledOnceWith', function() {
});
it('set the correct calls as verified when passing', function() {
const pp = jasmineUnderTest.makePrettyPrinter(),
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new jasmineUnderTest.Spy('called-spy');
const pp = privateUnderTest.makePrettyPrinter(),
util = new privateUnderTest.MatchersUtil({ pp: pp }),
matcher = privateUnderTest.matchers.toHaveBeenCalledOnceWith(util),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy('x');

View File

@@ -1,7 +1,7 @@
describe('toHaveBeenCalled', function() {
it('passes when the actual was called, with a custom .not fail message', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
calledSpy = new jasmineUnderTest.Spy('called-spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalled(),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy();
@@ -13,16 +13,16 @@ describe('toHaveBeenCalled', function() {
});
it('fails when the actual was not called', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
uncalledSpy = new jasmineUnderTest.Spy('uncalled spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalled(),
uncalledSpy = new privateUnderTest.Spy('uncalled spy');
const result = matcher.compare(uncalledSpy);
expect(result.pass).toBe(false);
});
it('throws an exception when the actual is not a spy', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toHaveBeenCalled({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {};
@@ -32,8 +32,8 @@ describe('toHaveBeenCalled', function() {
});
it('throws an exception when invoked with any arguments', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
spy = new jasmineUnderTest.Spy('sample spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalled(),
spy = new privateUnderTest.Spy('sample spy');
expect(function() {
matcher.compare(spy, 'foo');
@@ -41,8 +41,8 @@ describe('toHaveBeenCalled', function() {
});
it('has a custom message on failure', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
spy = new jasmineUnderTest.Spy('sample-spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalled(),
spy = new privateUnderTest.Spy('sample-spy');
const result = matcher.compare(spy);
@@ -52,8 +52,8 @@ describe('toHaveBeenCalled', function() {
});
it('set the correct calls as verified when passing', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
spy = new jasmineUnderTest.Spy('sample-spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalled(),
spy = new privateUnderTest.Spy('sample-spy');
spy();

View File

@@ -1,13 +1,13 @@
describe('toHaveBeenCalledTimes', function() {
it('passes when the actual 0 matches the expected 0 ', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
calledSpy = new jasmineUnderTest.Spy('called-spy'),
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
calledSpy = new privateUnderTest.Spy('called-spy'),
result = matcher.compare(calledSpy, 0);
expect(result.pass).toBeTruthy();
});
it('passes when the actual matches the expected', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
calledSpy = new jasmineUnderTest.Spy('called-spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy();
const result = matcher.compare(calledSpy, 1);
@@ -15,8 +15,8 @@ describe('toHaveBeenCalledTimes', function() {
});
it('fails when expected numbers is not supplied', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
spy = new jasmineUnderTest.Spy('spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
spy = new privateUnderTest.Spy('spy');
spy();
expect(function() {
@@ -27,16 +27,16 @@ describe('toHaveBeenCalledTimes', function() {
});
it('fails when the actual was called less than the expected', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
uncalledSpy = new jasmineUnderTest.Spy('uncalled spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
uncalledSpy = new privateUnderTest.Spy('uncalled spy');
const result = matcher.compare(uncalledSpy, 2);
expect(result.pass).toBe(false);
});
it('fails when the actual was called more than expected', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
uncalledSpy = new jasmineUnderTest.Spy('uncalled spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
uncalledSpy = new privateUnderTest.Spy('uncalled spy');
uncalledSpy();
uncalledSpy();
@@ -46,8 +46,8 @@ describe('toHaveBeenCalledTimes', function() {
});
it('throws an exception when the actual is not a spy', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {};
@@ -57,8 +57,8 @@ describe('toHaveBeenCalledTimes', function() {
});
it('has a custom message on failure that tells it was called only once', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
spy = new jasmineUnderTest.Spy('sample-spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
spy = new privateUnderTest.Spy('sample-spy');
spy();
spy();
spy();
@@ -73,8 +73,8 @@ describe('toHaveBeenCalledTimes', function() {
});
it('has a custom message on failure that tells how many times it was called', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
spy = new jasmineUnderTest.Spy('sample-spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
spy = new privateUnderTest.Spy('sample-spy');
spy();
spy();
spy();
@@ -89,8 +89,8 @@ describe('toHaveBeenCalledTimes', function() {
});
it('set the correct calls as verified when passing', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
spy = new jasmineUnderTest.Spy('sample-spy');
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
spy = new privateUnderTest.Spy('sample-spy');
spy();
spy();

View File

@@ -3,10 +3,10 @@ describe('toHaveBeenCalledWith', function() {
const matchersUtil = {
contains: jasmine.createSpy('delegated-contains').and.returnValue(true),
equals: jasmine.createSpy('delegated-equals').and.returnValue(true),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
calledSpy = new jasmineUnderTest.Spy('called-spy');
matcher = privateUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy('a', 'b');
const result = matcher.compare(calledSpy, 'a', 'b');
@@ -23,11 +23,11 @@ describe('toHaveBeenCalledWith', function() {
return true;
}
],
matchersUtil = new jasmineUnderTest.MatchersUtil({
matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: customEqualityTesters
}),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
calledSpy = new jasmineUnderTest.Spy('called-spy');
matcher = privateUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy('a', 'b');
const result = matcher.compare(calledSpy, 'a', 'b');
@@ -39,10 +39,10 @@ describe('toHaveBeenCalledWith', function() {
contains: jasmine
.createSpy('delegated-contains')
.and.returnValue(false),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
uncalledSpy = new jasmineUnderTest.Spy('uncalled spy');
matcher = privateUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
uncalledSpy = new privateUnderTest.Spy('uncalled spy');
const result = matcher.compare(uncalledSpy);
expect(result.pass).toBe(false);
@@ -52,11 +52,11 @@ describe('toHaveBeenCalledWith', function() {
});
it('fails when the actual was called with different parameters', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
calledSpy = new jasmineUnderTest.Spy('called spy');
matcher = privateUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
calledSpy = new privateUnderTest.Spy('called spy');
calledSpy('a');
calledSpy('c', 'd');
@@ -84,8 +84,8 @@ describe('toHaveBeenCalledWith', function() {
});
it('throws an exception when the actual is not a spy', function() {
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toHaveBeenCalledWith({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {};
@@ -98,10 +98,10 @@ describe('toHaveBeenCalledWith', function() {
const matchersUtil = {
contains: jasmine.createSpy('delegated-contains').and.returnValue(true),
equals: jasmine.createSpy('delegated-equals').and.returnValue(true),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
calledSpy = new jasmineUnderTest.Spy('called-spy');
matcher = privateUnderTest.matchers.toHaveBeenCalledWith(matchersUtil),
calledSpy = new privateUnderTest.Spy('called-spy');
calledSpy('a', 'b');
matcher.compare(calledSpy, 'a', 'b');

View File

@@ -1,6 +1,6 @@
describe('toHaveClass', function() {
it('fails for a DOM element that lacks the expected class', function() {
const matcher = jasmineUnderTest.matchers.toHaveClass(),
const matcher = privateUnderTest.matchers.toHaveClass(),
result = matcher.compare(
specHelpers.domHelpers.createElementWithClassName(''),
'foo'
@@ -10,7 +10,7 @@ describe('toHaveClass', function() {
});
it('passes for a DOM element that has the expected class', function() {
const matcher = jasmineUnderTest.matchers.toHaveClass(),
const matcher = privateUnderTest.matchers.toHaveClass(),
el = specHelpers.domHelpers.createElementWithClassName('foo bar baz');
expect(matcher.compare(el, 'foo').pass).toBe(true);
@@ -19,15 +19,15 @@ describe('toHaveClass', function() {
});
it('fails for a DOM element that only has other classes', function() {
const matcher = jasmineUnderTest.matchers.toHaveClass(),
const matcher = privateUnderTest.matchers.toHaveClass(),
el = specHelpers.domHelpers.createElementWithClassName('foo bar');
expect(matcher.compare(el, 'fo').pass).toBe(false);
});
it('throws an exception when actual is not a DOM element', function() {
const matcher = jasmineUnderTest.matchers.toHaveClass({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toHaveClass({
pp: privateUnderTest.makePrettyPrinter()
});
expect(function() {

View File

@@ -1,6 +1,6 @@
describe('toHaveClasses', function() {
it('fails for a DOM element that lacks all the expected classes', function() {
const matcher = jasmineUnderTest.matchers.toHaveClasses(),
const matcher = privateUnderTest.matchers.toHaveClasses(),
result = matcher.compare(
specHelpers.domHelpers.createElementWithClassName(''),
['foo', 'bar']
@@ -10,22 +10,22 @@ describe('toHaveClasses', function() {
});
it('passes for a DOM element that has all the expected classes', function() {
const matcher = jasmineUnderTest.matchers.toHaveClasses(),
const matcher = privateUnderTest.matchers.toHaveClasses(),
el = specHelpers.domHelpers.createElementWithClassName('foo bar baz');
expect(matcher.compare(el, ['foo', 'bar']).pass).toBe(true);
});
it('fails for a DOM element that only has some matching classes', function() {
const matcher = jasmineUnderTest.matchers.toHaveClasses(),
const matcher = privateUnderTest.matchers.toHaveClasses(),
el = specHelpers.domHelpers.createElementWithClassName('foo bar');
expect(matcher.compare(el, ['foo', 'can']).pass).toBe(false);
});
it('throws an exception when actual is not a DOM element', function() {
const matcher = jasmineUnderTest.matchers.toHaveClasses({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toHaveClasses({
pp: privateUnderTest.makePrettyPrinter()
});
expect(function() {

View File

@@ -1,6 +1,6 @@
describe('toHaveNoOtherSpyInteractions', function() {
it('passes when there are no spy interactions', function() {
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveNoOtherSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
@@ -10,8 +10,8 @@ describe('toHaveNoOtherSpyInteractions', function() {
});
it('passes when there are multiple spy interactions where checked by toHaveBeenCalled', function() {
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions();
let toHaveBeenCalledMatcher = jasmineUnderTest.matchers.toHaveBeenCalled();
let matcher = privateUnderTest.matchers.toHaveNoOtherSpyInteractions();
let toHaveBeenCalledMatcher = privateUnderTest.matchers.toHaveBeenCalled();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
@@ -26,10 +26,10 @@ describe('toHaveNoOtherSpyInteractions', function() {
});
it('fails when there are spy interactions', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
});
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions(
let matcher = privateUnderTest.matchers.toHaveNoOtherSpyInteractions(
matchersUtil
);
let spyObj = jasmineUnderTest
@@ -47,10 +47,10 @@ describe('toHaveNoOtherSpyInteractions', function() {
});
it('shows the right message is negated', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
});
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions(
let matcher = privateUnderTest.matchers.toHaveNoOtherSpyInteractions(
matchersUtil
);
let spyObj = jasmineUnderTest
@@ -70,7 +70,7 @@ describe('toHaveNoOtherSpyInteractions', function() {
});
it('passes when only non-observed spy object interactions are interacted', function() {
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveNoOtherSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
@@ -86,7 +86,7 @@ describe('toHaveNoOtherSpyInteractions', function() {
});
it('throws an error if a non-object is passed', function() {
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveNoOtherSpyInteractions();
expect(function() {
matcher.compare(true);
@@ -102,7 +102,7 @@ describe('toHaveNoOtherSpyInteractions', function() {
});
it('throws an error if arguments are passed', function() {
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveNoOtherSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('mySpyObj', ['spyA', 'spyB']);
@@ -113,7 +113,7 @@ describe('toHaveNoOtherSpyInteractions', function() {
});
it('throws an error if the spy object has no spies', function() {
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveNoOtherSpyInteractions();
const spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('mySpyObj', ['notSpy']);
@@ -129,13 +129,13 @@ describe('toHaveNoOtherSpyInteractions', function() {
});
it('handles multiple interactions with a single spy', function() {
const matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter()
const matchersUtil = new privateUnderTest.MatchersUtil({
pp: privateUnderTest.makePrettyPrinter()
}),
matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions(
matcher = privateUnderTest.matchers.toHaveNoOtherSpyInteractions(
matchersUtil
),
toHaveBeenCalledWithMatcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(
toHaveBeenCalledWithMatcher = privateUnderTest.matchers.toHaveBeenCalledWith(
matchersUtil
),
spyObj = jasmineUnderTest

View File

@@ -2,22 +2,22 @@ describe('toHaveSize', function() {
'use strict';
it('passes for an array whose length matches', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare([1, 2], 2);
expect(result.pass).toBe(true);
});
it('fails for an array whose length does not match', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare([1, 2, 3], 2);
expect(result.pass).toBe(false);
});
it('informs about the size of an array whose length does not match', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toHaveSize({
pp: privateUnderTest.makePrettyPrinter()
}),
result = matcher.compare([1, 2, 3], 2);
@@ -27,42 +27,42 @@ describe('toHaveSize', function() {
});
it('passes for an object with the proper number of keys', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare({ a: 1, b: 2 }, 2);
expect(result.pass).toBe(true);
});
it('fails for an object with a different number of keys', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare({ a: 1, b: 2 }, 1);
expect(result.pass).toBe(false);
});
it('passes for an object with an explicit `length` property that matches', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare({ a: 1, b: 2, length: 5 }, 5);
expect(result.pass).toBe(true);
});
it('fails for an object with an explicit `length` property that does not match', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare({ a: 1, b: 2, length: 5 }, 1);
expect(result.pass).toBe(false);
});
it('passes for a string whose length matches', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare('ab', 2);
expect(result.pass).toBe(true);
});
it('fails for a string whose length does not match', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare('abc', 2);
expect(result.pass).toBe(false);
@@ -73,7 +73,7 @@ describe('toHaveSize', function() {
map.set('a', 1);
map.set('b', 2);
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare(map, 2);
expect(result.pass).toBe(true);
@@ -84,7 +84,7 @@ describe('toHaveSize', function() {
map.set('a', 1);
map.set('b', 2);
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare(map, 1);
expect(result.pass).toBe(false);
@@ -95,7 +95,7 @@ describe('toHaveSize', function() {
set.add('a');
set.add('b');
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare(set, 2);
expect(result.pass).toBe(true);
@@ -106,14 +106,14 @@ describe('toHaveSize', function() {
set.add('a');
set.add('b');
const matcher = jasmineUnderTest.matchers.toHaveSize(),
const matcher = privateUnderTest.matchers.toHaveSize(),
result = matcher.compare(set, 1);
expect(result.pass).toBe(false);
});
it('throws an error for WeakSet', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize();
const matcher = privateUnderTest.matchers.toHaveSize();
expect(function() {
matcher.compare(new WeakSet(), 2);
@@ -121,7 +121,7 @@ describe('toHaveSize', function() {
});
it('throws an error for WeakMap', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize();
const matcher = privateUnderTest.matchers.toHaveSize();
expect(function() {
matcher.compare(new WeakMap(), 2);
@@ -129,7 +129,7 @@ describe('toHaveSize', function() {
});
it('throws an error for DataView', function() {
const matcher = jasmineUnderTest.matchers.toHaveSize();
const matcher = privateUnderTest.matchers.toHaveSize();
expect(function() {
matcher.compare(new DataView(new ArrayBuffer(128)), 2);

View File

@@ -1,6 +1,6 @@
describe('toHaveSpyInteractions', function() {
it('passes when there are spy interactions', function() {
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
@@ -12,7 +12,7 @@ describe('toHaveSpyInteractions', function() {
});
it('passes when there are multiple spy interactions', function() {
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
@@ -26,7 +26,7 @@ describe('toHaveSpyInteractions', function() {
});
it('fails when there are no spy interactions', function() {
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
@@ -39,7 +39,7 @@ describe('toHaveSpyInteractions', function() {
});
it('shows the right message is negated', function() {
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
@@ -55,7 +55,7 @@ describe('toHaveSpyInteractions', function() {
});
it('fails when only non-observed spy object interactions are interacted', function() {
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
@@ -71,7 +71,7 @@ describe('toHaveSpyInteractions', function() {
});
it('throws an error if a non-object is passed', function() {
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveSpyInteractions();
expect(function() {
matcher.compare(true);
@@ -87,7 +87,7 @@ describe('toHaveSpyInteractions', function() {
});
it('throws an error if arguments are passed', function() {
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
@@ -98,7 +98,7 @@ describe('toHaveSpyInteractions', function() {
});
it('throws an error if the spy object has no spies', function() {
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
let matcher = privateUnderTest.matchers.toHaveSpyInteractions();
const spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['notSpy']);

View File

@@ -1,34 +1,34 @@
describe('toMatch', function() {
it('passes when RegExps are equivalent', function() {
const matcher = jasmineUnderTest.matchers.toMatch();
const matcher = privateUnderTest.matchers.toMatch();
const result = matcher.compare(/foo/, /foo/);
expect(result.pass).toBe(true);
});
it('fails when RegExps are not equivalent', function() {
const matcher = jasmineUnderTest.matchers.toMatch();
const matcher = privateUnderTest.matchers.toMatch();
const result = matcher.compare(/bar/, /foo/);
expect(result.pass).toBe(false);
});
it('passes when the actual matches the expected string as a pattern', function() {
const matcher = jasmineUnderTest.matchers.toMatch();
const matcher = privateUnderTest.matchers.toMatch();
const result = matcher.compare('foosball', 'foo');
expect(result.pass).toBe(true);
});
it('fails when the actual matches the expected string as a pattern', function() {
const matcher = jasmineUnderTest.matchers.toMatch();
const matcher = privateUnderTest.matchers.toMatch();
const result = matcher.compare('bar', 'foo');
expect(result.pass).toBe(false);
});
it('throws an Error when the expected is not a String or RegExp', function() {
const matcher = jasmineUnderTest.matchers.toMatch();
const matcher = privateUnderTest.matchers.toMatch();
expect(function() {
matcher.compare('foo', { bar: 'baz' });

View File

@@ -1,6 +1,6 @@
describe('toThrowError', function() {
it('throws an error when the actual is not a function', function() {
const matcher = jasmineUnderTest.matchers.toThrowError();
const matcher = privateUnderTest.matchers.toThrowError();
expect(function() {
matcher.compare({});
@@ -8,7 +8,7 @@ describe('toThrowError', function() {
});
it('throws an error when the expected is not an Error, string, or RegExp', function() {
const matcher = jasmineUnderTest.matchers.toThrowError(),
const matcher = privateUnderTest.matchers.toThrowError(),
fn = function() {
throw new Error('foo');
};
@@ -19,7 +19,7 @@ describe('toThrowError', function() {
});
it('throws an error when the expected error type is not an Error', function() {
const matcher = jasmineUnderTest.matchers.toThrowError(),
const matcher = privateUnderTest.matchers.toThrowError(),
fn = function() {
throw new Error('foo');
};
@@ -30,7 +30,7 @@ describe('toThrowError', function() {
});
it('throws an error when the expected error message is not a string or RegExp', function() {
const matcher = jasmineUnderTest.matchers.toThrowError(),
const matcher = privateUnderTest.matchers.toThrowError(),
fn = function() {
throw new Error('foo');
};
@@ -41,7 +41,7 @@ describe('toThrowError', function() {
});
it('fails if actual does not throw at all', function() {
const matcher = jasmineUnderTest.matchers.toThrowError(),
const matcher = privateUnderTest.matchers.toThrowError(),
fn = function() {
return true;
};
@@ -53,8 +53,8 @@ describe('toThrowError', function() {
});
it('fails if thrown is not an instanceof Error', function() {
const matcher = jasmineUnderTest.matchers.toThrowError({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toThrowError({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {
throw 4;
@@ -85,7 +85,7 @@ describe('toThrowError', function() {
pending('This test only runs in browsers.');
}
const matcher = jasmineUnderTest.matchers.toThrowError();
const matcher = privateUnderTest.matchers.toThrowError();
iframe = document.body.appendChild(document.createElement('iframe'));
iframe.src = 'about:blank';
const iframeDocument = iframe.contentWindow.document;
@@ -103,8 +103,8 @@ describe('toThrowError', function() {
});
it('fails with the correct message if thrown is a falsy value', function() {
const matcher = jasmineUnderTest.matchers.toThrowError({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toThrowError({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {
throw undefined;
@@ -118,7 +118,7 @@ describe('toThrowError', function() {
});
it('passes if thrown is a type of Error, but there is no expected error', function() {
const matcher = jasmineUnderTest.matchers.toThrowError(),
const matcher = privateUnderTest.matchers.toThrowError(),
fn = function() {
throw new TypeError();
};
@@ -132,8 +132,8 @@ describe('toThrowError', function() {
});
it('passes if thrown is an Error and the expected is the same message', function() {
const matcher = jasmineUnderTest.matchers.toThrowError({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toThrowError({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {
throw new Error('foo');
@@ -148,8 +148,8 @@ describe('toThrowError', function() {
});
it('fails if thrown is an Error and the expected is not the same message', function() {
const matcher = jasmineUnderTest.matchers.toThrowError({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toThrowError({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {
throw new Error('foo');
@@ -164,8 +164,8 @@ describe('toThrowError', function() {
});
it('passes if thrown is an Error and the expected is a RegExp that matches the message', function() {
const matcher = jasmineUnderTest.matchers.toThrowError({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toThrowError({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {
throw new Error('a long message');
@@ -180,8 +180,8 @@ describe('toThrowError', function() {
});
it('fails if thrown is an Error and the expected is a RegExp that does not match the message', function() {
const matcher = jasmineUnderTest.matchers.toThrowError({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toThrowError({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {
throw new Error('a long message');
@@ -196,7 +196,7 @@ describe('toThrowError', function() {
});
it('passes if thrown is an Error and the expected the same Error', function() {
const matcher = jasmineUnderTest.matchers.toThrowError(),
const matcher = privateUnderTest.matchers.toThrowError(),
fn = function() {
throw new Error();
};
@@ -208,7 +208,7 @@ describe('toThrowError', function() {
});
it('passes if thrown is a custom error that takes arguments and the expected is the same error', function() {
const matcher = jasmineUnderTest.matchers.toThrowError(),
const matcher = privateUnderTest.matchers.toThrowError(),
CustomError = function CustomError(arg) {
arg.x;
},
@@ -227,7 +227,7 @@ describe('toThrowError', function() {
});
it('fails if thrown is an Error and the expected is a different Error', function() {
const matcher = jasmineUnderTest.matchers.toThrowError(),
const matcher = privateUnderTest.matchers.toThrowError(),
fn = function() {
throw new Error();
};
@@ -243,9 +243,9 @@ describe('toThrowError', function() {
it('passes if thrown is a type of Error and it is equal to the expected Error and message', function() {
const matchersUtil = {
equals: jasmine.createSpy('delegated-equal').and.returnValue(true),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
matcher = privateUnderTest.matchers.toThrowError(matchersUtil),
fn = function() {
throw new TypeError('foo');
};
@@ -261,9 +261,9 @@ describe('toThrowError', function() {
it('passes if thrown is a custom error that takes arguments and it is equal to the expected custom error and message', function() {
const matchersUtil = {
equals: jasmine.createSpy('delegated-equal').and.returnValue(true),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
matcher = privateUnderTest.matchers.toThrowError(matchersUtil),
CustomError = function CustomError(arg) {
this.message = arg.message;
},
@@ -285,9 +285,9 @@ describe('toThrowError', function() {
it('fails if thrown is a type of Error and the expected is a different Error', function() {
const matchersUtil = {
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
matcher = privateUnderTest.matchers.toThrowError(matchersUtil),
fn = function() {
throw new TypeError('foo');
};
@@ -305,9 +305,9 @@ describe('toThrowError', function() {
it('fails if thrown is a type of Error and the expected is a different Error', function() {
const matchersUtil = {
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
matcher = privateUnderTest.matchers.toThrowError(matchersUtil),
fn = function() {
throw new TypeError('foo');
};
@@ -324,9 +324,9 @@ describe('toThrowError', function() {
it('passes if thrown is a type of Error and has the same type as the expected Error and the message matches the expected message', function() {
const matchersUtil = {
equals: jasmine.createSpy('delegated-equal').and.returnValue(true),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
matcher = privateUnderTest.matchers.toThrowError(matchersUtil),
fn = function() {
throw new TypeError('foo');
};

View File

@@ -1,6 +1,6 @@
describe('toThrowMatching', function() {
it('throws an error when the actual is not a function', function() {
const matcher = jasmineUnderTest.matchers.toThrowMatching();
const matcher = privateUnderTest.matchers.toThrowMatching();
expect(function() {
matcher.compare({}, function() {
@@ -10,7 +10,7 @@ describe('toThrowMatching', function() {
});
it('throws an error when the expected is not a function', function() {
const matcher = jasmineUnderTest.matchers.toThrowMatching(),
const matcher = privateUnderTest.matchers.toThrowMatching(),
fn = function() {
throw new Error('foo');
};
@@ -21,7 +21,7 @@ describe('toThrowMatching', function() {
});
it('fails if actual does not throw at all', function() {
const matcher = jasmineUnderTest.matchers.toThrowMatching(),
const matcher = privateUnderTest.matchers.toThrowMatching(),
fn = function() {
return true;
};
@@ -35,8 +35,8 @@ describe('toThrowMatching', function() {
});
it('fails with the correct message if thrown is a falsy value', function() {
const matcher = jasmineUnderTest.matchers.toThrowMatching({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toThrowMatching({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {
throw undefined;
@@ -52,7 +52,7 @@ describe('toThrowMatching', function() {
});
it('passes if the argument is a function that returns true when called with the error', function() {
const matcher = jasmineUnderTest.matchers.toThrowMatching(),
const matcher = privateUnderTest.matchers.toThrowMatching(),
predicate = function(e) {
return e.message === 'nope';
},
@@ -69,8 +69,8 @@ describe('toThrowMatching', function() {
});
it('fails if the argument is a function that returns false when called with the error', function() {
const matcher = jasmineUnderTest.matchers.toThrowMatching({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toThrowMatching({
pp: privateUnderTest.makePrettyPrinter()
}),
predicate = function(e) {
return e.message === 'oh no';

View File

@@ -1,6 +1,6 @@
describe('toThrow', function() {
it('throws an error when the actual is not a function', function() {
const matcher = jasmineUnderTest.matchers.toThrow();
const matcher = privateUnderTest.matchers.toThrow();
expect(function() {
matcher.compare({});
@@ -9,7 +9,7 @@ describe('toThrow', function() {
});
it('fails if actual does not throw', function() {
const matcher = jasmineUnderTest.matchers.toThrow(),
const matcher = privateUnderTest.matchers.toThrow(),
fn = function() {
return true;
};
@@ -23,9 +23,9 @@ describe('toThrow', function() {
it('passes if it throws but there is no expected', function() {
const matchersUtil = {
equals: jasmine.createSpy('delegated-equal').and.returnValue(true),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toThrow(matchersUtil),
matcher = privateUnderTest.matchers.toThrow(matchersUtil),
fn = function() {
throw 5;
};
@@ -39,8 +39,8 @@ describe('toThrow', function() {
});
it('passes even if what is thrown is falsy', function() {
const matcher = jasmineUnderTest.matchers.toThrow({
pp: jasmineUnderTest.makePrettyPrinter()
const matcher = privateUnderTest.matchers.toThrow({
pp: privateUnderTest.makePrettyPrinter()
}),
fn = function() {
throw undefined;
@@ -56,9 +56,9 @@ describe('toThrow', function() {
it('passes if what is thrown is equivalent to what is expected', function() {
const matchersUtil = {
equals: jasmine.createSpy('delegated-equal').and.returnValue(true),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toThrow(matchersUtil),
matcher = privateUnderTest.matchers.toThrow(matchersUtil),
fn = function() {
throw 5;
};
@@ -72,9 +72,9 @@ describe('toThrow', function() {
it('fails if what is thrown is not equivalent to what is expected', function() {
const matchersUtil = {
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toThrow(matchersUtil),
matcher = privateUnderTest.matchers.toThrow(matchersUtil),
fn = function() {
throw 5;
};
@@ -90,9 +90,9 @@ describe('toThrow', function() {
it('fails if what is thrown is not equivalent to undefined', function() {
const matchersUtil = {
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
pp: jasmineUnderTest.makePrettyPrinter()
pp: privateUnderTest.makePrettyPrinter()
},
matcher = jasmineUnderTest.matchers.toThrow(matchersUtil),
matcher = privateUnderTest.matchers.toThrow(matchersUtil),
fn = function() {
throw 5;
};