forked from Pirate-Weather/translations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
29 lines (25 loc) · 847 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
var expect = require("chai").expect,
fs = require("fs"),
path = require("path"),
translation = require("./"),
util = require("util");
describe("translation", function() {
fs.readdirSync(path.join(__dirname, "test-cases")).forEach(function(lang) {
var name = path.basename(lang, ".json"),
translate = translation[name];
describe(name, function() {
var cases = JSON.parse(
fs.readFileSync(path.join(__dirname, "test-cases", lang))
);
Object.keys(cases).forEach(function(summary) {
var source = cases[summary];
it(
util.format("should translate %d to \"%s\"", source, summary),
function() {
expect(translate(source)).to.equal(summary);
}
);
});
});
});
});