Skip to content

Commit 16c4f90

Browse files
Brandon Dailflarnie
authored andcommitted
Add test for deprecation warnings
1 parent 8a01128 commit 16c4f90

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Copyright 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
* @emails react-core
10+
*/
11+
12+
'use strict';
13+
14+
describe('React', () => {
15+
16+
var React;
17+
18+
beforeEach(() => {
19+
React = require('React');
20+
});
21+
22+
it('should log a deprecation warning once when using React.__spread', () => {
23+
spyOn(console, 'error');
24+
React.__spread({});
25+
React.__spread({});
26+
expect(console.error.calls.count()).toBe(1);
27+
expect(console.error.calls.argsFor(0)[0]).toContain(
28+
'React.__spread is deprecated and should not be used'
29+
);
30+
});
31+
32+
it('should log a deprecation warning once when using React.createMixin', () => {
33+
spyOn(console, 'error');
34+
React.createMixin();
35+
React.createMixin();
36+
expect(console.error.calls.count()).toBe(1);
37+
expect(console.error.calls.argsFor(0)[0]).toContain(
38+
'React.createMixin is deprecated and should not be used'
39+
);
40+
});
41+
42+
});

0 commit comments

Comments
 (0)