Skip to content

Commit c6d93f7

Browse files
committed
test(normalize-dir): add normalize-dir test
1 parent c0ed4ff commit c6d93f7

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@
1919
},
2020
"peerDependencies": {
2121
"espower-loader": "~0.7.0"
22+
},
23+
"devDependencies": {
24+
"mocha": "^1.20.1"
2225
}
23-
}
26+
}

test/normalize-dir-test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"use strict";
2+
var assert = require("assert");
3+
var path = require("path");
4+
var normalizeDir = require("../lib/normalize-dir");
5+
describe("normalize-dir", function () {
6+
context("When string is ended with slash", function () {
7+
var string = ["path", "to", "file"].join(path.sep) + path.sep;
8+
it("should return same string", function () {
9+
assert.equal(normalizeDir(string), string);
10+
});
11+
});
12+
context("When string is ended without slash", function () {
13+
var string = ["path", "to", "file"].join(path.sep);
14+
it("should append slash", function () {
15+
assert.equal(normalizeDir(string), string + path.sep);
16+
});
17+
});
18+
});

0 commit comments

Comments
 (0)