Fixed test for the previous commit

This commit is contained in:
Amaury 2021-07-06 14:52:50 +02:00
parent fcf7c24b86
commit 086236f719
3 changed files with 7 additions and 7 deletions

View File

@ -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"
},

View File

@ -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;

View File

@ -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