-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
30 lines (25 loc) · 821 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
30
var test = require('tape');
var postcss = require('postcss');
var plugin = require('./');
var name = require('./package.json').name;
var tests = [{
message: 'should transform css',
fixture: 'h1 { color: red }',
expected: 'h1 { color: red }',
options: {foo: true}
}];
function process (css, options) {
return postcss(plugin(options)).process(css).css;
}
test(name, function (t) {
t.plan(tests.length);
tests.forEach(function (test) {
var options = test.options || {};
t.equal(process(test.fixture, options), test.expected, test.message);
});
});
test('should use the postcss plugin api', function (t) {
t.plan(2);
t.ok(plugin().postcssVersion, 'should be able to access version');
t.equal(plugin().postcssPlugin, name, 'should be able to access name');
});