Skip to content

Commit dda44b2

Browse files
committed
Fix JS tests
1 parent a666689 commit dda44b2

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.spec.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ describe('Comment', () => {
2020
// const author = findRenderedDOMComponentWithTag(component, 'h2');
2121
// expect(author.className).to.equal('comment-author');
2222
const text = findRenderedDOMComponentWithTag(component, 'span');
23-
expect(text.className).to.equal('comment-text');
23+
expect(text.className).to.equal('js-comment-text');
2424
});
2525

2626
it('shows the author', () => {
2727
const component = renderIntoDocument(
2828
<Comment author="Frank" text="Hi!"/>
2929
);
3030

31-
const author = findRenderedDOMComponentWithClass(component, 'comment-author');
31+
const author = findRenderedDOMComponentWithClass(component, 'js-comment-author');
3232
expect(author.textContent).to.equal('Frank');
3333
});
3434

@@ -37,7 +37,7 @@ describe('Comment', () => {
3737
<Comment author="Frank" text="Hi!"/>
3838
);
3939

40-
const comment = findRenderedDOMComponentWithClass(component, 'comment-text');
40+
const comment = findRenderedDOMComponentWithClass(component, 'js-comment-text');
4141
expect(comment.textContent).to.equal('Hi!\n');
4242
});
4343
});

client/app/libs/testNullCompiler.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const noop = () => null;
2+
3+
require.extensions['.css'] = noop;
4+
require.extensions['.scss'] = noop;
5+
require.extensions['.png'] = noop;
6+
require.extensions['.jpg'] = noop;
7+
require.extensions['.jpeg'] = noop;
8+
require.extensions['.gif'] = noop;

client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"homepage": "https://github.com/shakacode/react-webpack-rails-tutorial",
2626
"scripts": {
27-
"test": "NODE_PATH=./app mocha --compilers js:babel-core/register --require ./app/libs/testHelper.js 'app/**/*.spec.@(js|jsx)'",
27+
"test": "NODE_PATH=./app mocha --compilers js:babel-core/register --require ./app/libs/testHelper.js --require ./app/libs/testNullCompiler.js 'app/**/*.spec.@(js|jsx)'",
2828
"test:debug": "npm run test -- --debug-brk",
2929
"start": "node server.js",
3030
"build:client": "NODE_ENV=production webpack --config webpack.client.rails.build.config.js",

0 commit comments

Comments
 (0)