Upgrade to jest-cli@0.9 and use Jasmine2

This commit is contained in:
Paul O’Shannessy
2016-05-25 21:48:32 +01:00
committed by Dan Abramov
parent 510155e027
commit d8a0b9a662
57 changed files with 675 additions and 640 deletions
@@ -110,7 +110,7 @@ describe('Pooled class', function() {
PoolableClass.getPooled();
expect(function() {
PoolableClass.release(randomInstance);
}).toThrow(
}).toThrowError(
'Trying to release an instance into a pool of a different type.'
);
}
@@ -236,7 +236,7 @@ describe('Transaction', function() {
var transaction = new TestTransaction();
expect(function() {
transaction.perform(function() {});
}).toThrow(exceptionMsg);
}).toThrowError(exceptionMsg);
expect(transaction.isInTransaction()).toBe(false);
});
@@ -25,7 +25,7 @@ describe('accumulateInto', function() {
it('throws if the second item is null', function() {
expect(function() {
accumulateInto([], null);
}).toThrow(
}).toThrowError(
'accumulateInto(...): Accumulated items must not be null or undefined.'
);
});
@@ -29,7 +29,7 @@ describe('traverseAllChildren', function() {
it('should support identity for simple', function() {
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(true);
});
@@ -49,7 +49,7 @@ describe('traverseAllChildren', function() {
it('should treat single arrayless child as being in array', function() {
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(true);
});
@@ -68,7 +68,7 @@ describe('traverseAllChildren', function() {
spyOn(console, 'error');
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(true);
});
@@ -81,8 +81,8 @@ describe('traverseAllChildren', function() {
'.0'
);
expect(traverseContext.length).toEqual(1);
expect(console.error.calls.length).toBe(1);
expect(console.error.argsForCall[0][0]).toContain(
expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.ForCall(0)[0]).toContain(
'Warning: Each child in an array or iterator should have a unique "key" prop.'
);
});
@@ -96,7 +96,7 @@ describe('traverseAllChildren', function() {
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(true);
});
@@ -137,7 +137,7 @@ describe('traverseAllChildren', function() {
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(true);
});
@@ -157,7 +157,7 @@ describe('traverseAllChildren', function() {
traverseAllChildren(instance.props.children, traverseFn, traverseContext);
expect(traverseFn.calls.length).toBe(9);
expect(traverseFn.calls.count()).toBe(9);
expect(traverseContext.length).toEqual(9);
expect(traverseFn).toHaveBeenCalledWith(
@@ -205,7 +205,7 @@ describe('traverseAllChildren', function() {
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(true);
});
@@ -222,7 +222,7 @@ describe('traverseAllChildren', function() {
);
traverseAllChildren(instance.props.children, traverseFn, traverseContext);
expect(traverseFn.calls.length).toBe(4);
expect(traverseFn.calls.count()).toBe(4);
expect(traverseContext.length).toEqual(4);
expect(traverseFn).toHaveBeenCalledWith(
traverseContext,
@@ -254,7 +254,7 @@ describe('traverseAllChildren', function() {
var oneForceKey = <div key="keyOne" />;
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(true);
});
@@ -298,7 +298,7 @@ describe('traverseAllChildren', function() {
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(kid);
});
@@ -309,7 +309,7 @@ describe('traverseAllChildren', function() {
);
traverseAllChildren(instance.props.children, traverseFn, traverseContext);
expect(traverseFn.calls.length).toBe(3);
expect(traverseFn.calls.count()).toBe(3);
expect(traverseFn).toHaveBeenCalledWith(
traverseContext,
@@ -327,8 +327,8 @@ describe('traverseAllChildren', function() {
'.2'
);
expect(console.error.calls.length).toBe(1);
expect(console.error.argsForCall[0][0]).toContain(
expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.ForCall(0)[0]).toContain(
'Warning: Each child in an array or iterator should have a unique "key" prop.'
);
});
@@ -351,7 +351,7 @@ describe('traverseAllChildren', function() {
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(kid);
});
@@ -362,7 +362,7 @@ describe('traverseAllChildren', function() {
);
traverseAllChildren(instance.props.children, traverseFn, traverseContext);
expect(traverseFn.calls.length).toBe(3);
expect(traverseFn.calls.count()).toBe(3);
expect(traverseFn).toHaveBeenCalledWith(
traverseContext,
@@ -402,7 +402,7 @@ describe('traverseAllChildren', function() {
var traverseContext = [];
var traverseFn =
jasmine.createSpy().andCallFake(function(context, kid, key, index) {
jasmine.createSpy().and.callFake(function(context, kid, key, index) {
context.push(kid);
});
@@ -413,7 +413,7 @@ describe('traverseAllChildren', function() {
);
traverseAllChildren(instance.props.children, traverseFn, traverseContext);
expect(traverseFn.calls.length).toBe(3);
expect(traverseFn.calls.count()).toBe(3);
expect(traverseFn).toHaveBeenCalledWith(
traverseContext,
@@ -431,8 +431,8 @@ describe('traverseAllChildren', function() {
'.$#3:0'
);
expect(console.error.argsForCall.length).toBe(1);
expect(console.error.argsForCall[0][0]).toContain(
expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.argsFor(0)[0]).toContain(
'Warning: Using Maps as children is not yet fully supported. It is an ' +
'experimental feature that might be removed. Convert it to a sequence ' +
'/ iterable of keyed ReactElements instead.'
@@ -458,7 +458,7 @@ describe('traverseAllChildren', function() {
var traverseFn = jasmine.createSpy();
traverseAllChildren(instance.props.children, traverseFn, null);
expect(traverseFn.calls.length).toBe(3);
expect(traverseFn.calls.count()).toBe(3);
expect(traverseFn).toHaveBeenCalledWith(
null,
@@ -496,7 +496,7 @@ describe('traverseAllChildren', function() {
var traverseFn = jasmine.createSpy();
traverseAllChildren(instance.props.children, traverseFn, null);
expect(traverseFn.calls.length).toBe(2);
expect(traverseFn.calls.count()).toBe(2);
expect(traverseFn).toHaveBeenCalledWith(
null,
@@ -516,7 +516,7 @@ describe('traverseAllChildren', function() {
it('should throw on object', function() {
expect(function() {
traverseAllChildren({a: 1, b: 2}, function() {}, null);
}).toThrow(
}).toThrowError(
'Objects are not valid as a React child (found: object with keys ' +
'{a, b}). If you meant to render a collection of children, use an ' +
'array instead or wrap the object using createFragment(object) from ' +
@@ -529,7 +529,7 @@ describe('traverseAllChildren', function() {
// serialization (timezones) so let's test a regex instead:
expect(function() {
traverseAllChildren(/abc/, function() {}, null);
}).toThrow(
}).toThrowError(
'Objects are not valid as a React child (found: /abc/). If you meant ' +
'to render a collection of children, use an array instead or wrap the ' +
'object using createFragment(object) from the React add-ons.'