Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
Official Kuzzle Javascript SDK
======


Please use SDK v1.x for earlier versions of Kuzzle.
This SDK version is compatible with Kuzzle 1.0.0-RC9.5 and higher

## About Kuzzle

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kuzzle-sdk",
"version": "3.4.1",
"version": "3.4.2",
"description": "Official Javascript SDK for Kuzzle",
"author": "The Kuzzle Team <support@kuzzle.io>",
"repository": {
Expand Down
16 changes: 6 additions & 10 deletions src/Collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ Collection.prototype.search = function (filters, options, cb) {
*/
Collection.prototype.scroll = function (scrollId, options, filters, cb) {
var
request = {body:{}},
request = {},
self = this;

if (!scrollId) {
Expand All @@ -507,17 +507,13 @@ Collection.prototype.scroll = function (scrollId, options, filters, cb) {
options = {};
}

if (!options) {
options = {};
}

if (!options.scroll) {
throw new Error('Collection.scroll: scroll is required');
}
this.kuzzle.callbackRequired('Collection.scroll', cb);

options.scrollId = scrollId;
request.scrollId = scrollId;

this.kuzzle.callbackRequired('Collection.scroll', cb);
if (options && options.scroll) {
request.scroll = options.scroll;
}

this.kuzzle.query({controller: 'document', action: 'scroll'}, request, options, function (error, result) {
var documents = [];
Expand Down
9 changes: 2 additions & 7 deletions test/Collection/methods.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ describe('Collection methods', function () {
should(() => { collection.scroll(); }).throw('Collection.scroll: scrollId is required');
});

it('should throw an error if no scroll is provided', () => {
var collection = kuzzle.collection(expectedQuery.collection);
should(() => { collection.scroll('scrollId'); }).throw('Collection.scroll: scroll is required');
});

it('should throw an error if no callback is given', () => {
var collection = kuzzle.collection(expectedQuery.collection);
should(() => { collection.scroll('scrollId', {scroll: '1m'}); }).throw('Collection.scroll: a callback argument is required for read queries');
Expand All @@ -173,8 +168,8 @@ describe('Collection methods', function () {
queryScrollStub = function (args, query, opts, callback) {
should(args.controller).be.exactly('document');
should(args.action).be.exactly('scroll');
should(opts.scroll).be.exactly(options.scroll);
should(opts.scrollId).be.exactly(scrollId);
should(query.scroll).be.exactly(options.scroll);
should(query.scrollId).be.exactly(scrollId);

callback(null, {
result: {
Expand Down