Skip to content

Commit da8be4d

Browse files
committedDec 27, 2015
Fix broken "abort" test
1 parent 92744e8 commit da8be4d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎src/client.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CancellationToken
2929
@req.abort() if @req?
3030

3131
cancel: @::abort
32-
32+
wasAborted: @::isAborted
3333

3434
# HTTP Client for connecting to etcd servers
3535
class Client

‎test/index.coffee

+5-5
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,16 @@ describe 'Cancellation Token', ->
362362

363363
it 'should stop execution on abort', (done) ->
364364
http = getNock()
365+
.log(console.log)
365366
.get('/v2/keys/key')
366367
.reply(200, '{"action":"GET","key":"/key","value":"value","index":1}')
367368
etcd = new Etcd '127.0.0.1', 4001
368369

369-
token = etcd.version () -> throw new Error "Version call should have been aborted"
370+
# This sucks a bit.. are there any better way of checking that a callback
371+
# does not happen?
372+
token = etcd.get "key", () -> throw new Error "Call should have been aborted"
370373
token.abort()
371-
372-
etcd.get 'key', () ->
373-
http.isDone().should.be.true
374-
done()
374+
setTimeout done, 50
375375

376376

377377
describe 'Multiserver/Cluster support', ->

0 commit comments

Comments
 (0)
Please sign in to comment.