From de4d0989e939380ca5eb3d9e8bce398a7c1fe954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Sun, 26 Mar 2017 00:49:00 -0300 Subject: [PATCH 1/3] Add unit test function capFist calendar module --- tests/unit/functions/calendar_spec.js | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/unit/functions/calendar_spec.js diff --git a/tests/unit/functions/calendar_spec.js b/tests/unit/functions/calendar_spec.js new file mode 100644 index 0000000000..435e2e4d1e --- /dev/null +++ b/tests/unit/functions/calendar_spec.js @@ -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]); + }); + }); + }); +}); + From 320ce372f5ca85b3e0c97b5f4eeeaf488c097337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Wed, 19 Apr 2017 00:39:18 -0300 Subject: [PATCH 2/3] Add changelog unit test capFirst function on calendar module --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0816b3e96..2dfa5b2c9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add test check URLs of vendors. - Add test of match current week number on clock module with showWeek configuration. - Add test default modules present modules/default/defaultmodules.js. +- Add unit test calendar_modules function capFirst. ### Updated - Added missing keys to Polish translation. From 4904bd53efaa67c839592f8f1c687691155bc886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Wed, 19 Apr 2017 00:45:55 -0300 Subject: [PATCH 3/3] Fix grunt double quotes unit calendar_spec --- tests/unit/functions/calendar_spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/functions/calendar_spec.js b/tests/unit/functions/calendar_spec.js index 435e2e4d1e..2c7f62f881 100644 --- a/tests/unit/functions/calendar_spec.js +++ b/tests/unit/functions/calendar_spec.js @@ -19,10 +19,10 @@ describe("Functions into modules/default/calendar/calendar.js", function() { describe("capFirst", function() { words = { - 'rodrigo': 'Rodrigo', - '123m': '123m', - 'magic mirror': 'Magic mirror', - ',a': ',a', + "rodrigo": "Rodrigo", + "123m": "123m", + "magic mirror": "Magic mirror", + ",a": ",a", "ñandú": "Ñandú" };