nebulab-dropbox
Version:
Client library for the Dropbox API
47 lines (36 loc) • 1.67 kB
text/coffeescript
describe 'Dropbox.Http.PollResult', ->
describe '.parse', ->
describe 'on a timeout', ->
beforeEach ->
response = {"changes": false}
= Dropbox.Http.PollResult.parse response
it 'parses hasChanges correctly', ->
expect().to.have.property 'hasChanges'
expect(.hasChanges).to.equal false
it 'parses retryAfter correctly', ->
expect().to.have.property 'retryAfter'
expect(.retryAfter).to.equal 0
describe 'on a timeout with backoff', ->
beforeEach ->
response = {"changes": false, "backoff": 5}
= Dropbox.Http.PollResult.parse response
it 'parses hasChanges correctly', ->
expect().to.have.property 'hasChanges'
expect(.hasChanges).to.equal false
it 'parses retryAfter correctly', ->
expect().to.have.property 'retryAfter'
expect(.retryAfter).to.equal 5
describe 'on a change report', ->
beforeEach ->
response = {"changes": true}
= Dropbox.Http.PollResult.parse response
it 'parses hasChanges correctly', ->
expect().to.have.property 'hasChanges'
expect(.hasChanges).to.equal true
it 'parses retryAfter correctly', ->
expect().to.have.property 'retryAfter'
expect(.retryAfter).to.equal 0
it 'passes null through', ->
expect(Dropbox.Http.PollResult.parse(null)).to.equal null
it 'passes undefined through', ->
expect(Dropbox.Http.PollResult.parse(undefined)).to.equal undefined