Fix CSS tests (#839)

* Fix CSS tests

* Revamp

* -

* fix failing test

* add test for minifyCss with fixtures & snapshot

* remove unintended addition

* simplify the test.css
This commit is contained in:
Yangshun Tay 2018-07-10 10:42:32 -07:00 committed by GitHub
parent 8cd4b4fca6
commit 4267337fb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 178 additions and 88 deletions

View file

@ -0,0 +1,24 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const path = require('path');
const fs = require('fs');
const utils = require('../utils');
describe('server utils', () => {
test('minify css', () => {
const testCss = fs.readFileSync(
path.join(__dirname, '__fixtures__', 'test.css'),
'utf8'
);
const notCss = fs.readFileSync(
path.join(__dirname, '__fixtures__', 'test.md'),
'utf8'
);
utils.minifyCss(testCss).then(css => expect(css).toMatchSnapshot());
utils.minifyCss(notCss).catch(e => expect(e).toMatchSnapshot());
});
});