@@ -81,7 +81,7 @@ describe('pubsub', function() {
8181
8282 it ( 'should publish a message' , function ( done ) {
8383 pubsub . topic ( topicNames [ 0 ] )
84- . publish ( 'message from me' , done ) ;
84+ . publish ( { data : 'message from me' } , done ) ;
8585 } ) ;
8686
8787 it ( 'should be deleted' , function ( done ) {
@@ -176,15 +176,15 @@ describe('pubsub', function() {
176176 it ( 'should be able to pull and ack' , function ( done ) {
177177 var subscription = topic . subscription ( subscriptions [ 0 ] . name ) ;
178178
179- topic . publish ( 'hello' , function ( err ) {
179+ topic . publish ( { data : 'hello' } , function ( err ) {
180180 assert . ifError ( err ) ;
181181
182182 subscription . pull ( {
183183 returnImmediately : true ,
184- maxCount : 1
185- } , function ( err , msg ) {
184+ maxResults : 1
185+ } , function ( err , msgs ) {
186186 assert . ifError ( err ) ;
187- subscription . ack ( msg . ackId , done ) ;
187+ subscription . ack ( msgs [ 0 ] . ackId , done ) ;
188188 } ) ;
189189 } ) ;
190190 } ) ;
@@ -193,26 +193,26 @@ describe('pubsub', function() {
193193 var subscription = topic . subscription ( subscriptions [ 0 ] . name ) ;
194194
195195 topic . publish ( [
196- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
197- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
198- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
199- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
200- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
201- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
202- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
203- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
204- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
205- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) }
196+ { data : 'hello' } ,
197+ { data : 'hello' } ,
198+ { data : 'hello' } ,
199+ { data : 'hello' } ,
200+ { data : 'hello' } ,
201+ { data : 'hello' } ,
202+ { data : 'hello' } ,
203+ { data : 'hello' } ,
204+ { data : 'hello' } ,
205+ { data : 'hello' }
206206 ] , function ( err ) {
207207 assert . ifError ( err ) ;
208208
209209 subscription . pull ( {
210210 returnImmediately : true ,
211- maxCount : 1
212- } , function ( err , msg ) {
211+ maxResults : 1
212+ } , function ( err , msgs ) {
213213 assert . ifError ( err ) ;
214- assert . equal ( msg . data , 'hello' ) ;
215- subscription . ack ( msg . ackId , done ) ;
214+ assert . equal ( msgs [ 0 ] . data , 'hello' ) ;
215+ subscription . ack ( msgs [ 0 ] . ackId , done ) ;
216216 } ) ;
217217 } ) ;
218218 } ) ;
@@ -221,52 +221,52 @@ describe('pubsub', function() {
221221 var subscription = topic . subscription ( subscriptions [ 0 ] . name ) ;
222222
223223 topic . publish ( [
224- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
225- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
226- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
227- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
228- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
229- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
230- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
231- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
232- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
233- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) }
224+ { data : 'hello' } ,
225+ { data : 'hello' } ,
226+ { data : 'hello' } ,
227+ { data : 'hello' } ,
228+ { data : 'hello' } ,
229+ { data : 'hello' } ,
230+ { data : 'hello' } ,
231+ { data : 'hello' } ,
232+ { data : 'hello' } ,
233+ { data : 'hello' }
234234 ] , function ( err ) {
235235 assert . ifError ( err ) ;
236236
237237 subscription . pull ( {
238238 returnImmediately : true ,
239- maxCount : 1
240- } , function ( err , msg ) {
239+ maxResults : 1
240+ } , function ( err , msgs ) {
241241 assert . ifError ( err ) ;
242- assert . equal ( msg . data , 'hello' ) ;
243- subscription . ack ( msg . ackId , done ) ;
242+ assert . equal ( msgs [ 0 ] . data , 'hello' ) ;
243+ subscription . ack ( msgs [ 0 ] . ackId , done ) ;
244244 } ) ;
245245 } ) ;
246246 } ) ;
247247
248248 it ( 'should receive the chosen amount of results' , function ( done ) {
249249 var subscription = topic . subscription ( subscriptions [ 0 ] . name ) ;
250- var opts = { returnImmediately : true , maxCount : 3 } ;
250+ var opts = { returnImmediately : true , maxResults : 3 } ;
251251
252252 topic . publish ( [
253- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
254- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
255- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
256- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
257- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
258- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
259- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
260- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
261- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) } ,
262- { data : new Buffer ( 'hello' ) . toString ( 'base64' ) }
253+ { data : 'hello' } ,
254+ { data : 'hello' } ,
255+ { data : 'hello' } ,
256+ { data : 'hello' } ,
257+ { data : 'hello' } ,
258+ { data : 'hello' } ,
259+ { data : 'hello' } ,
260+ { data : 'hello' } ,
261+ { data : 'hello' } ,
262+ { data : 'hello' }
263263 ] , function ( err ) {
264264 assert . ifError ( err ) ;
265265
266266 subscription . pull ( opts , function ( err , messages ) {
267267 assert . ifError ( err ) ;
268268
269- assert . equal ( messages . length , opts . maxCount ) ;
269+ assert . equal ( messages . length , opts . maxResults ) ;
270270
271271 var ackIds = messages . map ( function ( message ) {
272272 return message . ackId ;
0 commit comments