From 086236f7193a19386ec6d3e8e4d6928e51cdca74 Mon Sep 17 00:00:00 2001 From: Amaury Date: Tue, 6 Jul 2021 14:52:50 +0200 Subject: [PATCH] Fixed test for the previous commit --- package.json | 2 +- src/listener-rss.ts | 8 ++++---- tests/index-spec.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 87251ae..f862bd2 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "build/index.d.ts", "scripts": { "test": "env TS_NODE_PROJECT='./tests/tsconfig.json' mocha --require ts-node/register ./tests/**/*-spec.ts", - "build": "tsc -p ./src", + "build": "tsc", "lint": "eslint 'tests/**/*.ts' 'src/**/*.ts'", "prepublish": "npm run-script build && npm run-script lint && npm test" }, diff --git a/src/listener-rss.ts b/src/listener-rss.ts index 4e8dcb7..ee24903 100644 --- a/src/listener-rss.ts +++ b/src/listener-rss.ts @@ -23,9 +23,9 @@ class ListenerRss extends EventEmitter { customfields?: { [key: string]: string[] | string }; // private fields - private parser: Parser; - private loopRunning: boolean = false; - private lastEntriesLinks: string[] = []; + parser: Parser; + loopRunning: boolean = false; + lastEntriesLinks: string[] = []; private firstUpdate = true; /** @@ -92,7 +92,7 @@ class ListenerRss extends EventEmitter { this.lastEntriesLinks = updatedEntriesLinks; - if (this.firstUpdate && newEntries.length !== 0) + if (!this.firstUpdate && newEntries.length !== 0) this.emit("newEntries", newEntries); this.firstUpdate = false; diff --git a/tests/index-spec.ts b/tests/index-spec.ts index ebb6b4d..f63ba86 100644 --- a/tests/index-spec.ts +++ b/tests/index-spec.ts @@ -420,7 +420,7 @@ describe("test class RSS: jsonfile", function () { // then await clock.tickAsync(1); expect(updateListenerSpy).to.have.been.calledOnce; - expect(newEntriesListenerSpy).to.have.been.calledOnce; + expect(newEntriesListenerSpy).to.not.have.been.called; // given stubParser.resolves(newRSSOutput); @@ -428,7 +428,7 @@ describe("test class RSS: jsonfile", function () { // then await clock.tickAsync(60000); expect(updateListenerSpy).to.have.been.calledTwice; - expect(newEntriesListenerSpy).to.have.been.calledTwice; + expect(newEntriesListenerSpy).to.have.been.calledOnce; expect(newEntriesListenerSpy).to.have.been.calledWith([newEntry]); // given