test: check replaced iff translatable comment
All translatable comments should be replaced, but nothing else.
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
d2ecd03013
commit
793fa8fb52
29
curriculum/test/utils/extract-jsx-comments.test.js
Normal file
29
curriculum/test/utils/extract-jsx-comments.test.js
Normal file
@ -0,0 +1,29 @@
|
||||
/* global expect */
|
||||
const extractJSXComments = require('./extract-jsx-comments');
|
||||
|
||||
const someJSX = `<Link
|
||||
className='btn-invert'
|
||||
to='/username'
|
||||
>
|
||||
Show me my public portfolio
|
||||
{/* JSX comment */}
|
||||
</Link>
|
||||
// single line comment
|
||||
|
||||
{/* JSX comment */}
|
||||
|
||||
/*
|
||||
a multiline comment
|
||||
*/
|
||||
`;
|
||||
|
||||
describe('extractJSXComments', () => {
|
||||
it('should return an object with comment keys and count values', () => {
|
||||
const commentCounts = {
|
||||
'JSX comment': 2,
|
||||
'single line comment': 1,
|
||||
'a multiline comment': 1
|
||||
};
|
||||
expect(extractJSXComments(someJSX)).toEqual(commentCounts);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user