diff --git a/CHANGELOG.md b/CHANGELOG.md index 53257e4a..de0802f4 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. @@ -24,6 +25,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fix instruction in README for using automatically installer script. - Bug of duplicated compliments as described in [here](https://forum.magicmirror.builders/topic/2381/compliments-module-stops-cycling-compliments). +- Fix double message about port when server is starting ## [2.1.1] - 2017-04-01 diff --git a/js/electron.js b/js/electron.js index 1f16092b..fbbdba94 100644 --- a/js/electron.js +++ b/js/electron.js @@ -51,7 +51,7 @@ function createWindow() { mainWindow.loadURL("http://localhost:" + config.port); // Open the DevTools if run with "npm start dev" - if(process.argv[2] == "dev") { + if (process.argv.includes("dev")) { mainWindow.webContents.openDevTools(); } diff --git a/js/server.js b/js/server.js index 36ebf740..2fc8dc6f 100644 --- a/js/server.js +++ b/js/server.js @@ -15,14 +15,13 @@ var fs = require("fs"); var helmet = require("helmet"); var Server = function(config, callback) { - console.log("Starting server on port " + config.port + " ... "); var port = config.port; if (process.env.MM_PORT) { port = process.env.MM_PORT; } - console.log("Starting server op port " + port + " ... "); + console.log("Starting server on port " + port + " ... "); server.listen(port, config.address ? config.address : null); diff --git a/modules/default/compliments/README.md b/modules/default/compliments/README.md index 171c86c0..ca75b475 100644 --- a/modules/default/compliments/README.md +++ b/modules/default/compliments/README.md @@ -88,7 +88,7 @@ config: { ], afternoon: [ "Hello, beauty!", - 'You look sexy!', + "You look sexy!", "Looking good today!" ], evening: [ @@ -110,9 +110,9 @@ around them ("morning", "afternoon", "evening", "snow", "rain", etc.). #### Example compliments.json file: ````json { - "anytime" : [ - "Hey there sexy!" - ], + "anytime" : [ + "Hey there sexy!" + ], "morning" : [ "Good morning, sunshine!", "Who needs coffee when you have your smile?", diff --git a/tests/unit/functions/calendar_spec.js b/tests/unit/functions/calendar_spec.js new file mode 100644 index 00000000..2c7f62f8 --- /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]); + }); + }); + }); +}); +