Skip to content

Commit

Permalink
Adding test for pagination service's complex query function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Sik committed Sep 29, 2015
1 parent b59d436 commit f4c9e4f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/src/common/services/pagination/paginationService.spec.ts
Expand Up @@ -396,6 +396,26 @@ interface mockEntity {

});

it('should be able to complex query the results to filter them', () => {

let paginator = paginationService.getPaginatorInstance('/collection').setCount(3);

$httpBackend.expectGET('/api/collection?q=%7B%22_all%22%3A%22foobar%22%2C%22entityId%22%3A%22foobarId%22%7D', (headers) => {
return headers.Range == 'entities=0-2'
})
.respond(206, _.take(collection, 3));

let results = paginator.complexQuery({
_all:'foobar',
entityId:'foobarId'
});

$httpBackend.flush();

expect(results).eventually.to.be.fulfilled;

});

it('should be able to query with an empty string', () => {

let paginator = paginationService.getPaginatorInstance('/collection').setCount(3);
Expand Down

0 comments on commit f4c9e4f

Please sign in to comment.