Fixed test for the previous commit
This commit is contained in:
parent
fcf7c24b86
commit
086236f719
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user