freeCodeCamp/curriculum/test/utils/extract-html-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

23 lines
472 B
JavaScript

/* global expect */
const extractHTMLComments = require('./extract-html-comments');
const someHTML = `<body>
Some text
<!-- a comment -->
<!-- a comment --><!-- another comment -->
</body>
`;
describe('extractHTMLComments', () => {
it('should return an object with comment keys and count values', () => {
const commentCounts = {
'a comment': 2,
'another comment': 1
};
expect(extractHTMLComments(someHTML)).toEqual(commentCounts);
});
});