/* global expect */ const extractCSSComments = require('./extract-css-comments'); const someHTMLWithCSS = ` Some text `; const outsideDeclarations = ` `; const mediaQuery = ` `; // NOTE: this is a bit finicky. If the css is, say, missing a semi-colon, // nearby comments may be missed. describe('extractCSSComments', () => { it('should return an object with comment keys and count values', () => { const commentCounts = { 'comment 1': 2, 'comment 2': 1 }; expect(extractCSSComments(someHTMLWithCSS)).toEqual(commentCounts); }); it('should catch comments outside of declarations', () => { const commentCounts = { 'comment 1': 2, 'comment 2': 1 }; expect(extractCSSComments(outsideDeclarations)).toEqual(commentCounts); }); it('should catch comments inside of media queries', () => { const commentCounts = { 'comment 1': 1, 'comment 2': 2 }; expect(extractCSSComments(mediaQuery)).toEqual(commentCounts); }); });