Merge pull request #861 from roramirez/unit-calendar

Unit calendar
This commit is contained in:
Michael Teeuw 2017-04-22 18:56:55 +02:00 committed by GitHub
commit 30aa8d469c
2 changed files with 37 additions and 0 deletions

View File

@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Add test check URLs of vendors. - Add test check URLs of vendors.
- Add test of match current week number on clock module with showWeek configuration. - Add test of match current week number on clock module with showWeek configuration.
- Add test default modules present modules/default/defaultmodules.js. - Add test default modules present modules/default/defaultmodules.js.
- Add unit test calendar_modules function capFirst.
### Updated ### Updated
- Added missing keys to Polish translation. - Added missing keys to Polish translation.

View File

@ -0,0 +1,36 @@
var fs = require("fs");
var path = require("path");
var chai = require("chai");
var expect = chai.expect;
var vm = require("vm");
describe("Functions into modules/default/calendar/calendar.js", function() {
// Fake for use by calendar.js
Module = {}
Module.definitions = {};
Module.register = function (name, moduleDefinition) {
Module.definitions[name] = moduleDefinition;
};
// load calendar.js
require("../../../modules/default/calendar/calendar.js");
describe("capFirst", function() {
words = {
"rodrigo": "Rodrigo",
"123m": "123m",
"magic mirror": "Magic mirror",
",a": ",a",
"ñandú": "Ñandú"
};
Object.keys(words).forEach(word => {
it(`for ${word} should return ${words[word]}`, function() {
expect(Module.definitions.calendar.capFirst(word)).to.equal(words[word]);
});
});
});
});