2018-09-08 20:48:46 +00:00
|
|
|
import { resolve } from 'path'
|
|
|
|
import fs from 'fs'
|
|
|
|
import { promisify } from 'util'
|
|
|
|
|
|
|
|
const readFile = promisify(fs.readFile)
|
|
|
|
|
|
|
|
describe('extract css', () => {
|
|
|
|
test('Verify global.css has been extracted and minified', async () => {
|
2018-09-20 19:57:37 +00:00
|
|
|
const pathToMinifiedGlobalCss = resolve(__dirname, '..', 'fixtures/extract-css/.nuxt/dist/client/09b0b6942acf2c3ab923.css')
|
2018-09-08 20:48:46 +00:00
|
|
|
const content = await readFile(pathToMinifiedGlobalCss, 'utf-8')
|
|
|
|
const expectedContent = 'h1[data-v-180e2718]{color:red}.container[data-v-180e2718]{-ms-grid-columns:60px 60px 60px 60px 60px;-ms-grid-rows:30px 30px;display:-ms-grid;display:grid;grid-auto-flow:row;grid-template-columns:60px 60px 60px 60px 60px;grid-template-rows:30px 30px}'
|
|
|
|
expect(content).toBe(expectedContent)
|
|
|
|
})
|
|
|
|
})
|