From 19a6869c55c1f5e81c27598891edd1ccdbee5e58 Mon Sep 17 00:00:00 2001 From: Amaury Date: Tue, 29 Jun 2021 17:49:01 +0200 Subject: [PATCH] Refactor name inside README and Tests --- README.md | 8 ++++---- tests/index-spec.ts | 30 ++++++++++++++---------------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5a3a77f..093869b 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ listener.stop(); # Documentation -## ListenerRSSInfo +## ListenerRss.Config An interface to structure listener's data. @@ -64,9 +64,9 @@ An interface to structure listener's data. ### Constructor -`constructor(listenerRSSInfo)` +`constructor(ListenerRss.Config)` -- listenerRSSInfo : object from the ListenerRSSInfo's class. +- ListenerRss.Config : object from the ListenerRss.Config's class. ### fetchRSS() @@ -116,7 +116,7 @@ This function will stop the execution of the callbackFun each time loop. ### getProperty() -This function will return a ListenerRssInfo (a.k.a. a JSON object) item corresponding to the internal configuration of the class. +This function will return a ListenerRss.Config (a.k.a. a JSON object) item corresponding to the internal configuration of the class. # Annexe diff --git a/tests/index-spec.ts b/tests/index-spec.ts index 9f66760..ebb6b4d 100644 --- a/tests/index-spec.ts +++ b/tests/index-spec.ts @@ -4,8 +4,6 @@ import * as Parser from "rss-parser"; // tested class import { ListenerRss } from "../"; -const ListenerRSSInfo = ListenerRss.Config; - // Unit test import assert from "assert"; import * as chai from "chai"; @@ -18,7 +16,7 @@ chai.use(sinonChai); const expect = chai.expect; describe("test class RSS: jsonfile", function () { - const infosListener: ListenerRRSInfo = { + const infosListener: ListenerRss.Config = { address: "fake.rss.service", timeloop: 15, customfields: { @@ -68,7 +66,7 @@ describe("test class RSS: jsonfile", function () { describe("Building Ytb listener", function () { it("builds with 4 params", function () { - const myListener = new Listeners({ + const myListener = new ListenerRss({ address: "fake.rss.service", timeloop: 15, customfields: { @@ -97,7 +95,7 @@ describe("test class RSS: jsonfile", function () { }); it("builds with 3 params (no custom fields)", function () { - const myListener = new Listeners({ + const myListener = new ListenerRss({ address: "fake.rss.service", timeloop: 15, lastEntriesLinks: ["my_url_02.com"], @@ -119,7 +117,7 @@ describe("test class RSS: jsonfile", function () { }); it("build with 3 params (no timeloop)", function () { - const myListener = new Listeners({ + const myListener = new ListenerRss({ address: "fake.rss.service", customfields: { description: ["media:group", "media:description"], @@ -147,7 +145,7 @@ describe("test class RSS: jsonfile", function () { }); it("build with 3 params (no lastEntries)", function () { - const myListener = new Listeners({ + const myListener = new ListenerRss({ address: "fake.rss.service", customfields: { description: ["media:group", "media:description"], @@ -174,7 +172,7 @@ describe("test class RSS: jsonfile", function () { }); it("builds with 1 params (only address)", function () { - const myListener = new Listeners({ + const myListener = new ListenerRss({ address: "fake.rss.service", }); @@ -197,7 +195,7 @@ describe("test class RSS: jsonfile", function () { describe("export property", function () { it("should export properties into a ListenerRSSInfos", function () { // given - const myListener = new Listeners(infosListener); + const myListener = new ListenerRss(infosListener); // assertions expect(myListener.getProperty()).to.be.eql(infosListener); @@ -213,7 +211,7 @@ describe("test class RSS: jsonfile", function () { const stubParser = mockManager.mock("parseURL"); stubParser.resolves(mockedRSSOutput); - const myListener = new Listeners(infosListener); + const myListener = new ListenerRss(infosListener); // when const res = await myListener.fetchRSS(); @@ -233,7 +231,7 @@ describe("test class RSS: jsonfile", function () { const err = new Error("connect ECONNREFUSED 127.0.0.1:80"); stubParser.rejects(err); - const myListener = new Listeners({ + const myListener = new ListenerRss({ address: "bad.rss.service", customfields: { description: ["media:group", "media:description"], @@ -257,7 +255,7 @@ describe("test class RSS: jsonfile", function () { stubParser.resolves(mockedRSSOutput); // classic build - const myListener = new Listeners(infosListener); + const myListener = new ListenerRss(infosListener); //spy const updateListenerSpy = sinon.spy(); @@ -288,7 +286,7 @@ describe("test class RSS: jsonfile", function () { stubParser.resolves(mockedRSSOutput); // classic build - const myListener = new Listeners({ + const myListener = new ListenerRss({ ...infosListener, timeloop: 15, }); @@ -343,7 +341,7 @@ describe("test class RSS: jsonfile", function () { stubParser.rejects(expectedErr); // classic build - const myListener = new Listeners({ + const myListener = new ListenerRss({ ...infosListener, timeloop: 60, }); @@ -404,7 +402,7 @@ describe("test class RSS: jsonfile", function () { }; // classic build - const myListener = new Listeners({ + const myListener = new ListenerRss({ ...infosListener, timeloop: 60, }); @@ -469,7 +467,7 @@ describe("test class RSS: jsonfile", function () { }; // classic build - const myListener = new Listeners({ + const myListener = new ListenerRss({ ...infosListener, timeloop: 60, lastEntriesLinks: ["my_url_02.com", "my_url_01.com", "my_url_00.com"],