UNPKG

usemin

Version:

Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views).

31 lines (26 loc) 1.02 kB
'use strict'; var fs = require('fs'); var expect = require('chai').expect; var getConfig = require('../lib/getConfig'); var getBlocks = require('../lib/getBlocks'); var getHtml = require('../lib/getHtml'); var inputsDir = 'test/fixtures/'; var config = getConfig(false); describe('Get HTML', function () { it('should get HTML correctly', function () { var src = inputsDir + 'index.html'; var content = fs.readFileSync(src).toString(); var outcome = fs.readFileSync(inputsDir + 'outcome.html').toString(); var blocks = getBlocks(src, content, true); var html = getHtml(content, blocks, false, config); expect(html).to.eql(outcome); }); it('should get minified HTML correctly', function () { var src = inputsDir + 'index.html'; var content = fs.readFileSync(src).toString(); var outcome = fs.readFileSync(inputsDir + 'htmlmin.html').toString(); var blocks = getBlocks(src, content, true); var html = getHtml(content, blocks, true, config); expect(html + '\n').to.equal(outcome); }); });