@samitouri / QOS-React-2 / commits / 23deea0f02

Add test for deprecation warnings

Brandon Dail committed Jan 23, 2017 at 18:07 UTC 23deea0f02818823b6f3ac9bf94a5d051721c671
1 file changed +42
src/isomorphic/__tests__/React-test.js new
+42
@@ -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 + expectDev(console.error.calls.count()).toBe(1);
27 + expectDev(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 + expectDev(console.error.calls.count()).toBe(1);
37 + expectDev(console.error.calls.argsFor(0)[0]).toContain(
38 + 'React.createMixin is deprecated and should not be used'
39 + );
40 + });
41 +
42 +});