Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Commit 8671f60

Browse files
Tests working properly
1 parent d004116 commit 8671f60

File tree

5 files changed

+6
-20
lines changed

5 files changed

+6
-20
lines changed

__tests__/example-test.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
jest.unmock('../public/scripts/bundle.js');
1+
jest.unmock('../public/scripts/example.js');
22

33
var React = require('react');
44
var ReactDOM = require('react-dom');
@@ -21,12 +21,11 @@ describe('TestCommentBoxComponent', () => {
2121
expect(ReactTestUtils.isCompositeComponent(commentBox)).toBeTruthy();
2222
});
2323

24-
/*it('class should equal commentBox', () => {
24+
it('class should equal commentBox', () => {
2525
expect(boxNode.className).toEqual('commentBox');
26-
});*/
26+
});
2727

2828
it('initial state data should be empty', () => {
29-
console.log('!!!!!!',commentBox)
3029
expect(commentBox.getInitialState()).toBeDefined();
3130
const commentBoxData = commentBox.getInitialState().data;
3231
expect(commentBoxData).toBeDefined();

comments.json

+1-11
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,5 @@
2323
"id": 1464988717637,
2424
"author": "evil",
2525
"text": "<a href=\"javascript:alert(1)\">alert(1)</a>"
26-
},
27-
{
28-
"id": 1491402159891,
29-
"author": "fghgh",
30-
"text": "gfhgfh"
31-
},
32-
{
33-
"id": 1491402930256,
34-
"author": "cvcvb",
35-
"text": "zbzv"
3626
}
37-
]
27+
]

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"babel-preset-react": "^6.5.0",
1212
"body-parser": "^1.4.3",
1313
"express": "^4.4.5",
14-
"jQuery": "^1.7.4",
1514
"jest-cli": "^13.0.0",
1615
"jquery": "^3.2.1",
1716
"react": "^15.1.0",
17+
"react-addons-test-utils": "^15.4.2",
1818
"react-dom": "^15.1.0"
1919
},
2020
"devDependencies": {

public/scripts/example.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1111
*/
1212
var React = require('react');
13+
var $ = require('jquery');
1314

1415
var Comment = React.createClass({
1516
rawMarkup: function() {
@@ -145,4 +146,3 @@ var CommentForm = React.createClass({
145146
module.exports = {
146147
CommentBox: CommentBox
147148
}
148-

public/scripts/render.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/**
2-
* Created by lewa on 24/06/2016.
3-
*/
41
var CommentBox = require('./example.js').CommentBox;
52

63
ReactDOM.render(

0 commit comments

Comments
 (0)