freeCodeCamp/curriculum/test/utils/extract-jsx-comments.test.js
Oliver Eyton-Williams 793fa8fb52 test: check replaced iff translatable comment
All translatable comments should be replaced, but nothing else.
2020-10-22 03:18:13 +05:30

30 lines
587 B
JavaScript

/* 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);
});
});