Merge pull request #965 from roramirez/newfeed-unit

Newfeed unit
This commit is contained in:
Michael Teeuw 2017-07-31 15:00:37 +02:00 committed by GitHub
commit 1d9a404f77
3 changed files with 42 additions and 2 deletions

View File

@ -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 `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 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 `.vscode/` folder to `.gitignore` to keep custom Visual Studio Code config out of git
- Add unit test the capitalizeFirstLetter function of newfeed module
### Updated ### Updated
- Changed 'default.js' - listen on all attached interfaces by default - Changed 'default.js' - listen on all attached interfaces by default

View File

@ -14,8 +14,10 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
Module.definitions[name] = moduleDefinition; Module.definitions[name] = moduleDefinition;
}; };
before(function() {
// load calendar.js // load calendar.js
require("../../../modules/default/calendar/calendar.js"); require("../../../modules/default/calendar/calendar.js");
});
describe("capFirst", function() { describe("capFirst", function() {
words = { words = {

View File

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