Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@beshur
Created May 12, 2019 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beshur/e01836db7f7ff8ffb073eb696a578b29 to your computer and use it in GitHub Desktop.
Save beshur/e01836db7f7ff8ffb073eb696a578b29 to your computer and use it in GitHub Desktop.
describe('RequestRepeater functions', function() {
it('should make request and repeat it at least once', function(done) {
const requestRepeater = new RequestRepeater({
request: MOCK_REQUEST,
delay: 1000
})
let times = 0;
requestRepeater.requestAndRepeat()
requestRepeater.on('result', (result, error) => {
times++
if (times > 1) {
requestRepeater.stopTimer()
}
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment