Skip to content

Commit 16ea589

Browse files
datastore: fix: kindless queries with namespace (#2263)
1 parent 3daf236 commit 16ea589

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

handwritten/datastore/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ Datastore.NO_MORE_RESULTS = 'NO_MORE_RESULTS';
440440
* var query = datastore.createQuery('Company');
441441
*/
442442
Datastore.prototype.createQuery = function(namespace, kind) {
443-
if (arguments.length === 1) {
444-
kind = arrify(namespace);
443+
if (arguments.length < 2) {
444+
kind = namespace;
445445
namespace = this.namespace;
446446
}
447447

handwritten/datastore/test/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,14 @@ describe('Datastore', function() {
284284
assert.strictEqual(query.calledWith_[1], datastore.namespace);
285285
assert.deepEqual(query.calledWith_[2], kind);
286286
});
287+
288+
it('should include the default namespace in a kindless query', function() {
289+
var query = datastore.createQuery();
290+
291+
assert.strictEqual(query.calledWith_[0], datastore);
292+
assert.strictEqual(query.calledWith_[1], datastore.namespace);
293+
assert.deepEqual(query.calledWith_[2], []);
294+
});
287295
});
288296

289297
describe('key', function() {

0 commit comments

Comments
 (0)