add test for dev
This commit is contained in:
parent
283cd3eb26
commit
49b39a5c52
1 changed files with 29 additions and 11 deletions
|
@ -3,6 +3,30 @@ import * as cheerio from 'cheerio';
|
||||||
import { loadFixture, isWindows } from './test-utils.js';
|
import { loadFixture, isWindows } from './test-utils.js';
|
||||||
|
|
||||||
describe('minification html', () => {
|
describe('minification html', () => {
|
||||||
|
describe('in the dev', () => {
|
||||||
|
let fixture;
|
||||||
|
let devServer;
|
||||||
|
const regex = /[\r\n]+/gm;
|
||||||
|
before(async () => {
|
||||||
|
fixture = await loadFixture({
|
||||||
|
root: './fixtures/minification-html/',
|
||||||
|
});
|
||||||
|
devServer = await fixture.startDevServer();
|
||||||
|
});
|
||||||
|
|
||||||
|
after(async () => {
|
||||||
|
devServer.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Verify that the HTML code is compressed in the dev', async () => {
|
||||||
|
let res = await fixture.fetch(`/`);
|
||||||
|
expect(res.status).to.equal(200);
|
||||||
|
const html = await res.text();
|
||||||
|
expect(regex.test(html.slice(-100))).to.equal(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
describe('build', () => {
|
||||||
let fixture;
|
let fixture;
|
||||||
const regex = /[\r\n]+/gm;
|
const regex = /[\r\n]+/gm;
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
@ -10,15 +34,9 @@ describe('minification html', () => {
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Build', () => {
|
it('Verify that the HTML code is compressed in the pro', async () => {
|
||||||
before(async () => {
|
|
||||||
await fixture.build();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('validating the html is or not is minification ', async () => {
|
|
||||||
const html = await fixture.readFile('/index.html');
|
const html = await fixture.readFile('/index.html');
|
||||||
expect(regex.test(html.slice(20))).to.equal(false);
|
expect(regex.test(html.slice(20))).to.equal(false);
|
||||||
});
|
});
|
||||||
|
})
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue