Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Weirich <matthias.weirich@selectcode.de>
  • Loading branch information
vavido committed Dec 6, 2022
1 parent 0783e5b commit 02116e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion javascript/lib/api/src/options/request.options.ts
Expand Up @@ -353,7 +353,7 @@ export class DefaultSearchOptions extends AbstractRequestOptions<DefaultSearchOp
return this.setOption();
}

public withCursor(cursor: string): DefaultCountOptions {
public withCursor(cursor: string): DefaultSearchOptions {
this.optionParameters.set(`cursor`, cursor);
return this.setOption();
}
Expand Down
18 changes: 18 additions & 0 deletions javascript/lib/api/tests/options/request.options.spec.ts
Expand Up @@ -212,6 +212,24 @@ describe('Search Options', () => {
searchOptions.withLimit(3, 4).withSort('-B');
expect(searchOptions.getOptions().get('option')).toEqual(encodeURIComponent('limit(3,4),sort(-B)'));
});
it('sets cursor', () => {
searchOptions.withCursor('eJylkD1PwzAQhv-LpxQc5YM0SbNBBBJDp0oslMGxz82JYJfLBQbEf8cpQupGKfZ29zz3Su');
expect(searchOptions.getOptions().get('option')).toEqual('cursor(eJylkD1PwzAQhv-LpxQc5YM0SbNBBBJDp0oslMGxz82JYJfLBQbEf8cpQupGKfZ29zz3Su)');
});
it('overrides cursor', () => {
searchOptions.withCursor('foo');
searchOptions.withCursor('bar');
expect(searchOptions.getOptions().get('option')).toEqual('cursor(bar)');
});
it('sets page size', () => {
searchOptions.withPageSize(42);
expect(searchOptions.getOptions().get('option')).toEqual('size(42)');
});
it('overrides page size', () => {
searchOptions.withPageSize(42);
searchOptions.withPageSize(10);
expect(searchOptions.getOptions().get('option')).toEqual('size(10)');
});
});

describe('Get Things Options', () => {
Expand Down

0 comments on commit 02116e5

Please sign in to comment.