Merge branch 'develop' into bugfix-compliment-duplicates

This commit is contained in:
Michael Teeuw 2017-04-22 18:58:26 +02:00 committed by GitHub
commit 7db07bca35
5 changed files with 44 additions and 7 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.
@ -24,6 +25,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed ### Fixed
- Fix instruction in README for using automatically installer script. - 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). - 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 ## [2.1.1] - 2017-04-01

View File

@ -51,7 +51,7 @@ function createWindow() {
mainWindow.loadURL("http://localhost:" + config.port); mainWindow.loadURL("http://localhost:" + config.port);
// Open the DevTools if run with "npm start dev" // Open the DevTools if run with "npm start dev"
if(process.argv[2] == "dev") { if (process.argv.includes("dev")) {
mainWindow.webContents.openDevTools(); mainWindow.webContents.openDevTools();
} }

View File

@ -15,14 +15,13 @@ var fs = require("fs");
var helmet = require("helmet"); var helmet = require("helmet");
var Server = function(config, callback) { var Server = function(config, callback) {
console.log("Starting server on port " + config.port + " ... ");
var port = config.port; var port = config.port;
if (process.env.MM_PORT) { if (process.env.MM_PORT) {
port = 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); server.listen(port, config.address ? config.address : null);

View File

@ -88,7 +88,7 @@ config: {
], ],
afternoon: [ afternoon: [
"Hello, beauty!", "Hello, beauty!",
'You look sexy!', "You look sexy!",
"Looking good today!" "Looking good today!"
], ],
evening: [ evening: [
@ -110,9 +110,9 @@ around them ("morning", "afternoon", "evening", "snow", "rain", etc.).
#### Example compliments.json file: #### Example compliments.json file:
````json ````json
{ {
"anytime" : [ "anytime" : [
"Hey there sexy!" "Hey there sexy!"
], ],
"morning" : [ "morning" : [
"Good morning, sunshine!", "Good morning, sunshine!",
"Who needs coffee when you have your smile?", "Who needs coffee when you have your smile?",

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]);
});
});
});
});