orizens / ngx-infinite-scroll

Infinite Scroll Directive for Angular
https://www.npmjs.com/package/ngx-infinite-scroll
MIT License
1.23k stars 224 forks source link

fix failing test throttle #389

Closed Serrulien closed 2 years ago

Serrulien commented 2 years ago

This PR fix a failing test case.

steps:

There is one failing test case:

  Scroll Regsiter
    √ should create a Observable of scroll observable
    × should create a Observable of scroll observable with default 300 throttle
        Expected 1 to be greater than or equal 300.
            at SafeSubscriber._next (spec.bundle.js:99090:32)

Seems like the test case was written for the sampleTime strategy. The elapsed time between start end end was near 0ms because ThrottleTime emits a value then ignores other values for a duration (when leading is true, trailing is false). Therefore the expected elapsed time for the test nammed should create a Observable of scroll observable with default 300 throttle could not be 300ms.


A non failing test suit will encourage people to contribute to the project.

Serrulien commented 2 years ago

@orizens I have rebased this PR, ready for your review