Make polling tests more reliable with longer timeouts

I was using a very short polling interval of 10ms for testing polling
mixin. This lets a little room for any timing problems, which may happen
with setTimeout or setInterval. Increasing it to 20ms hopefully can make
it more reliable.
This commit is contained in:
Piotr Sarnacki 2015-05-05 10:06:18 +02:00
parent a85f0ebc9f
commit e2db99c7fd

View File

@ -15,7 +15,7 @@ test 'polls for each of the models', ->
history = [] history = []
service = Polling.create( service = Polling.create(
pollingInterval: 10 pollingInterval: 20
) )
model1 = { model1 = {
@ -42,13 +42,13 @@ test 'polls for each of the models', ->
Ember.run -> Ember.run ->
service.destroy() service.destroy()
, 15 , 30
test 'it will stop running any reloads after it is destroyed', -> test 'it will stop running any reloads after it is destroyed', ->
expect(1) expect(1)
service = Polling.create( service = Polling.create(
pollingInterval: 10 pollingInterval: 20
) )
model = { model = {
@ -63,11 +63,11 @@ test 'it will stop running any reloads after it is destroyed', ->
setTimeout -> setTimeout ->
Ember.run -> Ember.run ->
service.destroy() service.destroy()
, 15 , 30
setTimeout -> setTimeout ->
start() start()
, 30 , 50
test 'it stops reloading models after they were removed from polling', -> test 'it stops reloading models after they were removed from polling', ->
expect(4) expect(4)
@ -75,7 +75,7 @@ test 'it stops reloading models after they were removed from polling', ->
history = [] history = []
service = Polling.create( service = Polling.create(
pollingInterval: 10 pollingInterval: 30
) )
model1 = { model1 = {
@ -105,8 +105,8 @@ test 'it stops reloading models after they were removed from polling', ->
start() start()
deepEqual history, ['model1', 'model2', 'model1'] deepEqual history, ['model1', 'model2', 'model1']
, 10 , 30
, 12 , 40
test 'it runs a hook on each interval', -> test 'it runs a hook on each interval', ->
expect(1) expect(1)
@ -114,7 +114,7 @@ test 'it runs a hook on each interval', ->
history = [] history = []
service = Polling.create( service = Polling.create(
pollingInterval: 10 pollingInterval: 20
) )
source = { source = {
@ -135,7 +135,7 @@ test 'it runs a hook on each interval', ->
start() start()
, 10 , 10
, 12 , 30
test 'it will not run pollHook if the source is destroyed', -> test 'it will not run pollHook if the source is destroyed', ->
expect(1) expect(1)
@ -143,7 +143,7 @@ test 'it will not run pollHook if the source is destroyed', ->
history = [] history = []
service = Polling.create( service = Polling.create(
pollingInterval: 10 pollingInterval: 20
) )
source = Ember.Object.extend( source = Ember.Object.extend(
@ -164,5 +164,5 @@ test 'it will not run pollHook if the source is destroyed', ->
service.destroy() service.destroy()
start() start()
, 30 , 35
, 12 , 30