-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
29 lines (23 loc) · 738 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import {Buffer} from 'node:buffer';
import test from 'ava';
import Vinyl from 'vinyl';
import {pEvent} from 'p-event';
import stripCssComments from './index.js';
test('main', async t => {
const stream = stripCssComments({whitespace: true});
const dataPromise = pEvent(stream, 'data');
stream.end(new Vinyl({
contents: Buffer.from('body{/* d */}'),
}));
const file = await dataPromise;
t.is(file.contents.toString(), 'body{}');
});
test('whitespace option', async t => {
const stream = stripCssComments({whitespace: false});
const dataPromise = pEvent(stream, 'data');
stream.end(new Vinyl({
contents: Buffer.from('body{/* foo */}'),
}));
const file = await dataPromise;
t.is(file.contents.toString(), 'body{}');
});