Skip to content

Commit

Permalink
test(pagedRequest): test if the paged method of the rest module corre…
Browse files Browse the repository at this point in the history
…ctly parses the given url witho
  • Loading branch information
philippspo committed Mar 1, 2016
1 parent 27f9665 commit fef9c3f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/spec/connect/rest.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,16 @@ describe 'Rest', ->
withTotal: false
done()

it 'should not overwrite duplicate url parameters', (done) ->
spyOn(@pagedRest, 'GET').andCallThrough()
@pagedRest.PAGED "/products?expand=foo&expand=bar", (e, r, b) =>
url = @pagedRest.GET.calls[0].args[0]
query = url.split('?')[1]
query = query.split('&')
expect(query[0]).toEqual('expand=foo')
expect(query[1]).toEqual('expand=bar')
done()

it 'should correctly return error', (done) ->
spyOn(@pagedRest, 'GET').andCallFake (endpoint, callback) ->
callback('Oops', {statusCode: 500}, null)
Expand Down

0 comments on commit fef9c3f

Please sign in to comment.