diff --git a/CHANGELOG.md b/CHANGELOG.md index 065a074a..bc5dc0ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add `clientonly` script to start only the electron client for a remote server. - Add symbol and color properties of event when `CALENDAR_EVENTS` notification is broadcasted from `default/calendar` module. - Add `.vscode/` folder to `.gitignore` to keep custom Visual Studio Code config out of git +- Add unit test the capitalizeFirstLetter function of newfeed module ### Updated - Changed 'default.js' - listen on all attached interfaces by default diff --git a/tests/unit/functions/calendar_spec.js b/tests/unit/functions/calendar_spec.js index 2c7f62f8..be699847 100644 --- a/tests/unit/functions/calendar_spec.js +++ b/tests/unit/functions/calendar_spec.js @@ -14,8 +14,10 @@ describe("Functions into modules/default/calendar/calendar.js", function() { Module.definitions[name] = moduleDefinition; }; - // load calendar.js - require("../../../modules/default/calendar/calendar.js"); + before(function() { + // load calendar.js + require("../../../modules/default/calendar/calendar.js"); + }); describe("capFirst", function() { words = { diff --git a/tests/unit/functions/newsfeed_spec.js b/tests/unit/functions/newsfeed_spec.js new file mode 100644 index 00000000..583d696a --- /dev/null +++ b/tests/unit/functions/newsfeed_spec.js @@ -0,0 +1,37 @@ +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/newsfeed/newsfeed.js", function() { + + Module = {} + Module.definitions = {}; + Module.register = function (name, moduleDefinition) { + Module.definitions[name] = moduleDefinition; + }; + + // load newsfeed.js + require("../../../modules/default/newsfeed/newsfeed.js"); + + describe("capitalizeFirstLetter", 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.newsfeed.capitalizeFirstLetter(word)).to.equal(words[word]); + }); + }); + }); + +}); +