freeCodeCamp/curriculum/test/utils/extract-html-comments.test.js

22 lines
452 B
JavaScript

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