mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 23:11:29 -04:00
Initialize snowflake instance with a config
This commit is contained in:
parent
edbbea1d03
commit
2d8a1690ba
11 changed files with 125 additions and 113 deletions
|
@ -25,7 +25,7 @@ describe 'Broker', ->
|
|||
# fake successful request and response from broker.
|
||||
spyOn(b, '_postRequest').and.callFake ->
|
||||
b._xhr.readyState = b._xhr.DONE
|
||||
b._xhr.status = Broker.STATUS_OK
|
||||
b._xhr.status = Broker.STATUS.OK
|
||||
b._xhr.responseText = 'fake offer'
|
||||
b._xhr.onreadystatechange()
|
||||
poll = b.getClientOffer()
|
||||
|
@ -35,7 +35,7 @@ describe 'Broker', ->
|
|||
expect(desc).toEqual 'fake offer'
|
||||
done()
|
||||
.catch ->
|
||||
fail 'should not reject on Broker.STATUS_OK'
|
||||
fail 'should not reject on Broker.STATUS.OK'
|
||||
done()
|
||||
|
||||
it 'rejects if the broker timed-out', (done) ->
|
||||
|
@ -43,16 +43,16 @@ describe 'Broker', ->
|
|||
# fake timed-out request from broker
|
||||
spyOn(b, '_postRequest').and.callFake ->
|
||||
b._xhr.readyState = b._xhr.DONE
|
||||
b._xhr.status = Broker.STATUS_GATEWAY_TIMEOUT
|
||||
b._xhr.status = Broker.STATUS.GATEWAY_TIMEOUT
|
||||
b._xhr.onreadystatechange()
|
||||
poll = b.getClientOffer()
|
||||
expect(poll).not.toBeNull()
|
||||
expect(b._postRequest).toHaveBeenCalled()
|
||||
poll.then (desc) ->
|
||||
fail 'should not fulfill on GATEWAY_TIMEOUT'
|
||||
fail 'should not fulfill on Broker.STATUS.GATEWAY_TIMEOUT'
|
||||
done()
|
||||
, (err) ->
|
||||
expect(err).toBe Broker.MESSAGE_TIMEOUT
|
||||
expect(err).toBe Broker.MESSAGE.TIMEOUT
|
||||
done()
|
||||
|
||||
it 'rejects on any other status', (done) ->
|
||||
|
@ -69,7 +69,7 @@ describe 'Broker', ->
|
|||
fail 'should not fulfill on non-OK status'
|
||||
done()
|
||||
, (err) ->
|
||||
expect(err).toBe Broker.MESSAGE_UNEXPECTED
|
||||
expect(err).toBe Broker.MESSAGE.UNEXPECTED
|
||||
expect(b._xhr.status).toBe 1337
|
||||
done()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue