Remove unused helper function and its unit test

This commit is contained in:
rejas 2020-07-12 09:56:25 +02:00
parent d00da790af
commit 8dc88fe64b
2 changed files with 4 additions and 29 deletions

View File

@ -332,17 +332,6 @@ Module.register("newsfeed", {
}, this.config.updateInterval);
},
/* capitalizeFirstLetter(string)
* Capitalizes the first character of a string.
*
* argument string string - Input string.
*
* return string - Capitalized output string.
*/
capitalizeFirstLetter: function (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},
resetDescrOrFullArticleAndTimer: function () {
this.isShowingDescription = this.config.showDescription;
this.config.showFullArticle = false;

View File

@ -1,29 +1,15 @@
var expect = require("chai").expect;
describe("Functions into modules/default/newsfeed/newsfeed.js", function () {
// Fake for use by newsletter.js
Module = {};
Module.definitions = {};
Module.register = function (name, moduleDefinition) {
Module.definitions[name] = moduleDefinition;
};
// load newsfeed.js
require("../../../modules/default/newsfeed/newsfeed.js");
describe("capitalizeFirstLetter", function () {
const 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]);
});
});
before(function () {
// load newsfeed.js
require("../../../modules/default/newsfeed/newsfeed.js");
});
});