From 0117cd478b99fd9e68560e05619408b78b2d75ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Sun, 26 Mar 2017 16:19:45 -0300
Subject: [PATCH 1/4] Unit test for capitalizeFirstLetter newfeed module
---
tests/unit/functions/newsfeed_spec.js | 37 +++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 tests/unit/functions/newsfeed_spec.js
diff --git a/tests/unit/functions/newsfeed_spec.js b/tests/unit/functions/newsfeed_spec.js
new file mode 100644
index 00000000..eb001075
--- /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]);
+ });
+ });
+ });
+
+});
+
From 4fee4d190383c03b77285ad601de1a59810c607e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Thu, 20 Jul 2017 00:10:01 -0400
Subject: [PATCH 2/4] Add Changelog Unit test for capitalizeFirstLetter
newfeed module
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 592a521f..244d53ec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added
- 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 unit test the capitalizeFirstLetter function of newfeed module
### Updated
- Changed 'default.js' - listen on all attached interfaces by default
From 66b7e3e1f5cc93c45f3d2828eaa63417e7002576 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Thu, 20 Jul 2017 00:27:57 -0400
Subject: [PATCH 3/4] Fix lint newsfeed_spec
---
tests/unit/functions/newsfeed_spec.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/unit/functions/newsfeed_spec.js b/tests/unit/functions/newsfeed_spec.js
index eb001075..583d696a 100644
--- a/tests/unit/functions/newsfeed_spec.js
+++ b/tests/unit/functions/newsfeed_spec.js
@@ -18,10 +18,10 @@ describe("Functions into modules/default/newsfeed/newsfeed.js", function() {
describe("capitalizeFirstLetter", function() {
words = {
- 'rodrigo': 'Rodrigo',
- '123m': '123m',
- 'magic mirror': 'Magic mirror',
- ',a': ',a',
+ "rodrigo": "Rodrigo",
+ "123m": "123m",
+ "magic mirror": "Magic mirror",
+ ",a": ",a",
"ñandú": "Ñandú",
".!": ".!"
};
From e08bc01c335bbcf123507b16e63e0e8c6addafc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Tue, 25 Jul 2017 09:32:32 -0400
Subject: [PATCH 4/4] Fix conflict with test function newsfeed
---
tests/unit/functions/calendar_spec.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
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 = {