Skip to content

Commit b0b483f

Browse files
committed
Emit the keys rather than the whole object.
1 parent d6488ec commit b0b483f

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

lib/protocol-buffers-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ProtocolBuffersClient.prototype.keys = function(bucket, options, callback) {
6666
meta.chunked = true;
6767
var emitter = this._execute('getKeys', meta);
6868
emitter.on('data', function(data) {
69-
emitter.emit('keys', data);
69+
emitter.emit('keys', data['keys']);
7070
})
7171
emitter.start = function() {};
7272
return emitter;

test/protocol-buffers-client-test.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,21 @@ describe('protocol-buffers-client-tests', function() {
8787
});
8888

8989
it("Fetches keys", function(done) {
90-
var keys = db.keys('pb-users', {keys: 'stream'});
91-
var result = []
92-
keys.on('keys', function(keys) {
93-
result.push(keys);
94-
}).on('end', function(data) {
95-
result.should.have.length(5);
96-
done();
90+
db.save('pb-users', 'user1@gmail.com', {name: 'Joe Example'}, {content_type: "application/json"}, function(data) {
91+
db.save('pb-users', 'user2@gmail.com', {name: 'Joe Example'}, {content_type: "application/json"}, function(data) {
92+
db.save('pb-users', 'user3@gmail.com', {name: 'Joe Example'}, {content_type: "application/json"}, function(data) {
93+
db.save('pb-users', 'user4@gmail.com', {name: 'Joe Example'}, {content_type: "application/json"}, function(data) {
94+
var keys = db.keys('pb-users', {keys: 'stream'});
95+
var result = []
96+
keys.on('keys', function(keys) {
97+
result = result.concat(keys);
98+
}).on('end', function(data) {
99+
result.should.have.length(5);
100+
done();
101+
});
102+
});
103+
});
104+
});
97105
});
98106
});
99107
});

0 commit comments

Comments
 (0)