Skip to content

Commit 3276b09

Browse files
committed
added simple tests
1 parent d5ba7f6 commit 3276b09

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"css-modules-loader-core": "0.0.11",
88
"object-assign": "^3.0.0"
99
},
10-
"devDependencies": {},
10+
"devDependencies": {
11+
"mocha": "^2.2.5"
12+
},
1113
"scripts": {
1214
"test": "mocha test"
1315
},

test/example.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.app
2+
{
3+
background: #999;
4+
}

test/index.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
describe('css-modules-require-hook', function () {
2+
'use strict';
3+
4+
var assert = require('assert');
5+
var styles;
6+
7+
before(function (done) {
8+
// loading hook
9+
require('..');
10+
11+
try {
12+
styles = require('./example.css');
13+
done();
14+
} catch(e) {
15+
done(e);
16+
}
17+
});
18+
19+
it('loaded an object from "example.css" as a module', function () {
20+
assert.strictEqual(typeof styles, 'object');
21+
});
22+
23+
it('module has the "app" key', function () {
24+
assert(styles.hasOwnProperty('app'));
25+
});
26+
27+
it('the value of the "app" key is not an empty string', function () {
28+
assert.strictEqual(typeof styles.app, 'string', 'app\'s value is not a string');
29+
assert(styles.app, 'app contains an empty string');
30+
});
31+
});

0 commit comments

Comments
 (0)