Test enhancement (fix given / when / then) #3
|
@ -416,26 +416,32 @@ describe("test class RSS: jsonfile", function () {
|
|||
|
||||
// when
|
||||
myListener.start();
|
||||
await clock.tickAsync(1);
|
||||
|
||||
|
||||
// then
|
||||
await clock.tickAsync(1);
|
||||
expect(updateListenerSpy).to.have.been.calledOnce;
|
||||
expect(newEntriesListenerSpy).to.not.have.been.called;
|
||||
expect(newEntriesListenerSpy).to.have.been.calledOnce;
|
||||
|
||||
// given
|
||||
stubParser.resolves(newRSSOutput);
|
||||
|
||||
// then
|
||||
// when
|
||||
await clock.tickAsync(60000);
|
||||
|
||||
|
||||
// then
|
||||
expect(updateListenerSpy).to.have.been.calledTwice;
|
||||
expect(newEntriesListenerSpy).to.have.been.calledOnce;
|
||||
expect(newEntriesListenerSpy).to.have.been.calledTwice;
|
||||
expect(newEntriesListenerSpy).to.have.been.calledWith([newEntry]);
|
||||
|
||||
// given
|
||||
newEntriesListenerSpy.resetHistory();
|
||||
|
||||
// then
|
||||
// when
|
||||
await clock.tickAsync(60000);
|
||||
|
||||
// then
|
||||
expect(updateListenerSpy).to.have.been.calledThrice;
|
||||
expect(updateListenerSpy).to.have.been.calledWith(mockedRSSOutput);
|
||||
expect(newEntriesListenerSpy).to.not.have.been.called;
|
||||
|
@ -482,17 +488,20 @@ describe("test class RSS: jsonfile", function () {
|
|||
|
||||
// when
|
||||
myListener.start();
|
||||
await clock.tickAsync(1);
|
||||
|
||||
|
||||
// then
|
||||
await clock.tickAsync(1);
|
||||
expect(updateListenerSpy).to.have.been.calledOnce;
|
||||
expect(newEntriesListenerSpy).to.not.have.been.calledOnce;
|
||||
|
||||
// given
|
||||
stubParser.resolves(newRSSOutput);
|
||||
|
||||
// then
|
||||
// when
|
||||
await clock.tickAsync(60000);
|
||||
|
||||
// then
|
||||
expect(updateListenerSpy).to.have.been.calledTwice;
|
||||
expect(newEntriesListenerSpy).to.have.been.calledOnce;
|
||||
expect(newEntriesListenerSpy).to.have.been.calledWith([newEntry]);
|
||||
|
@ -500,8 +509,10 @@ describe("test class RSS: jsonfile", function () {
|
|||
// given
|
||||
newEntriesListenerSpy.resetHistory();
|
||||
|
||||
// then
|
||||
// when
|
||||
await clock.tickAsync(60000);
|
||||
|
||||
// then
|
||||
expect(updateListenerSpy).to.have.been.calledThrice;
|
||||
expect(updateListenerSpy).to.have.been.calledWith(mockedRSSOutput);
|
||||
expect(newEntriesListenerSpy).to.not.have.been.called;
|
||||
|
|
Loading…
Reference in New Issue
Block a user