Skip to content

Commit 8a3238d

Browse files
committed
Clean up test contexts
1 parent 6bbb01c commit 8a3238d

File tree

5 files changed

+38
-42
lines changed

5 files changed

+38
-42
lines changed

test/test-custom-parser.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
var expect = require('chai').expect;
22

3-
describe('postcss-loader', function () {
3+
describe('custom parser', function () {
44

5-
context('when config defines syntax function', function () {
6-
it('processes sugarss', function () {
7-
var css = require('!raw-loader!../!' +
8-
'./support/cases/sugar.css');
9-
expect(css).to.eql('a\n color: rgba(255, 0, 0, 0.1)\n');
10-
});
5+
it('processes sugarss', function () {
6+
var css = require('!raw-loader!../!' +
7+
'./support/cases/sugar.css');
8+
expect(css).to.eql('a\n color: rgba(255, 0, 0, 0.1)\n');
119
});
10+
1211
});

test/test-default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var expect = require('chai').expect;
22

3-
describe('postcss-loader', function () {
3+
describe('default', function () {
44

55
it('processes CSS with default plugins', function () {
66
var css = require('!raw-loader!../!./support/cases/style.css');

test/test-explicit-plugins.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
var expect = require('chai').expect;
22

3-
describe('postcss-loader', function () {
3+
describe('explicit plugins', function () {
44

5-
context('when config adds plugins', function () {
6-
it('processes CSS with custom plugins', function () {
7-
var css = require('!raw-loader!../!' +
8-
'./support/cases/style.css');
9-
expect(css).to.eql('a { color: rgba(255, 0, 0, 0.1) }\n');
10-
});
5+
it('processes CSS with custom plugins', function () {
6+
var css = require('!raw-loader!../!' +
7+
'./support/cases/style.css');
8+
expect(css).to.eql('a { color: rgba(255, 0, 0, 0.1) }\n');
119
});
10+
1211
});

test/test-incorrect-using-packs.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
var expect = require('chai').expect;
22

3-
describe('postcss-loader', function () {
3+
describe('incorrect using packs', function () {
44

5-
context('when config does not define packs', function () {
6-
it('fails to load specific pack', function () {
7-
var compile = function () {
8-
// Try-catch to change webpack error into warning
9-
try {
10-
require('!raw-loader!../../?pack=blues!' +
11-
'../support/cases/style.css');
12-
} catch (ex) {
13-
// and then propagate runtime error
14-
throw ex;
15-
}
16-
};
5+
it('fails to load specific pack', function () {
6+
var compile = function () {
7+
// Try-catch to change webpack error into warning
8+
try {
9+
require('!raw-loader!../../?pack=blues!' +
10+
'../support/cases/style.css');
11+
} catch (ex) {
12+
// and then propagate runtime error
13+
throw ex;
14+
}
15+
};
1716

18-
expect(compile).to.throw('Cannot find module');
19-
});
17+
expect(compile).to.throw('Cannot find module');
2018
});
19+
2120
});

test/test-with-packs.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
var expect = require('chai').expect;
22

3-
describe('postcss-loader', function () {
3+
describe('with packs', function () {
44

5-
context('when config defines packs', function () {
6-
it('processes CSS with default plugins', function () {
7-
var css = require('!raw-loader!../!' +
8-
'./support/cases/style.css');
9-
expect(css).to.eql('a { color: rgba(255, 0, 0, 0.1) }\n');
10-
});
5+
it('processes CSS with default plugins', function () {
6+
var css = require('!raw-loader!../!' +
7+
'./support/cases/style.css');
8+
expect(css).to.eql('a { color: rgba(255, 0, 0, 0.1) }\n');
9+
});
1110

12-
it('processes CSS with custom plugins', function () {
13-
var css = require('!raw-loader!../?pack=blues!' +
14-
'./support/cases/style.css');
15-
expect(css).to.eql('a { color: blue }\n');
16-
});
11+
it('processes CSS with custom plugins', function () {
12+
var css = require('!raw-loader!../?pack=blues!' +
13+
'./support/cases/style.css');
14+
expect(css).to.eql('a { color: blue }\n');
1715
});
16+
1817
});

0 commit comments

Comments
 (0)