Permalink
Browse files

Emit the keys rather than the whole object.

  • Loading branch information...
1 parent d6488ec commit b0b483f28325e517a52e08cb3adac77bd1e40b11 @roidrage roidrage committed May 3, 2013
Showing with 16 additions and 8 deletions.
  1. +1 −1 lib/protocol-buffers-client.js
  2. +15 −7 test/protocol-buffers-client-test.js
@@ -66,7 +66,7 @@ ProtocolBuffersClient.prototype.keys = function(bucket, options, callback) {
meta.chunked = true;
var emitter = this._execute('getKeys', meta);
emitter.on('data', function(data) {
- emitter.emit('keys', data);
+ emitter.emit('keys', data['keys']);
})
emitter.start = function() {};
return emitter;
@@ -87,13 +87,21 @@ describe('protocol-buffers-client-tests', function() {
});
it("Fetches keys", function(done) {
- var keys = db.keys('pb-users', {keys: 'stream'});
- var result = []
- keys.on('keys', function(keys) {
- result.push(keys);
- }).on('end', function(data) {
- result.should.have.length(5);
- done();
+ db.save('pb-users', 'user1@gmail.com', {name: 'Joe Example'}, {content_type: "application/json"}, function(data) {
+ db.save('pb-users', 'user2@gmail.com', {name: 'Joe Example'}, {content_type: "application/json"}, function(data) {
+ db.save('pb-users', 'user3@gmail.com', {name: 'Joe Example'}, {content_type: "application/json"}, function(data) {
+ db.save('pb-users', 'user4@gmail.com', {name: 'Joe Example'}, {content_type: "application/json"}, function(data) {
+ var keys = db.keys('pb-users', {keys: 'stream'});
+ var result = []
+ keys.on('keys', function(keys) {
+ result = result.concat(keys);
+ }).on('end', function(data) {
+ result.should.have.length(5);
+ done();
+ });
+ });
+ });
+ });
});
});
});

0 comments on commit b0b483f

Please sign in to comment.