basic.test.js 941 B

123456789101112131415161718192021
  1. const templateMinify = require("../minifyTemplate.js")
  2. test('Test Empty string', () => {
  3. expect(templateMinify("")).toBe("");
  4. });
  5. test('Test simple html string', () => {
  6. expect(templateMinify("html`\r\r\n <div> html test\r</div> `",{collapseWhitespace: true}))
  7. .toBe("html`<div>html test</div>`;");
  8. });
  9. test('Test simple css string', () => {
  10. expect(templateMinify("css`.className{\r\n\tborder-width : 8px;\r\n}`",{collapseWhitespace: true,minifyCSS:true}))
  11. .toBe("css`.className{border-width:8px}`;");
  12. });
  13. test('Test simple svg string', () => {
  14. expect(templateMinify('svg`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="24" width="24">\r\n<path d="M0 0h24v24H0z"/>\r\n</svg>`',{collapseWhitespace: true}))
  15. .toBe('svg`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="24" width="24"><path d="M0 0h24v24H0z"/></svg>`;');
  16. });