我刚开始使用React进行编码,我已经制作了第一个应用程序,现在我想为它添加一个测试。我正在使用Jasmine进行测试。当我尝试运行测试时,我收到错误:
Warning: require('react/addons') is deprecated. Access using require('react-addons-{addon}') instead.
/opt/lampp/htdocs/video_portal/client/js/components/Layout.js:1
(function (exports, require, module, __filename, __dirname) { import React from "react";
我的layout.js页面在这里只有最少的代码。
import React from "react";
import $ from "jquery";
export default class Layout extends React.Component {
render() {
return (
<div class="full-width"></div>
);
}
}
testfile在这里:
var React = require('react');
var addons = require('react/addons');
var Layout = require('../../client/js/components/Layout.js');
var TestUtils = React.addons.TestUtils;
var testUtilsAdditions = require('react-testutils-additions');
var ReactTestUtils = require('react-addons-test-utils');
describe('Layout', function() {
var Utils = React.addons.TestUtils;
/* Test cases will be here.*/
})