@@ -91,24 +91,28 @@ test('an empty pool', function() {
9191 } )
9292} )
9393
94- test ( 'when creating async new pool members' , function ( ) {
95- var count = 0 ;
96- var pool = new Pool ( 3 , function ( ) {
97- var item = { ref : { name : ++ count } , checkedIn : false } ;
98- process . nextTick ( function ( ) {
99- pool . checkIn ( item . ref )
100- } )
101- return item ;
94+ test ( 'a pool with size of zero' , function ( ) {
95+ var index = 0 ;
96+ var pool = new Pool ( 0 , function ( ) {
97+ return index ++ ;
98+ } )
99+ test ( 'checkin does nothing' , function ( ) {
100+ index = 0 ;
101+ pool . checkIn ( 301813 ) ;
102+ assert . equal ( pool . checkOut ( assert . calls ( function ( err , item ) {
103+ assert . equal ( item , 0 ) ;
104+ } ) ) ) ;
102105 } )
103- test ( 'one request recieves member' , function ( ) {
106+ test ( 'always creates a new item' , function ( ) {
107+ index = 0 ;
104108 pool . checkOut ( assert . calls ( function ( err , item ) {
105- assert . equal ( item . name , 1 )
106- pool . checkOut ( assert . calls ( function ( err , item ) {
107- assert . equal ( item . name , 2 )
108- pool . checkOut ( assert . calls ( function ( err , item ) {
109- assert . equal ( item . name , 3 )
110- } ) )
111- } ) )
109+ assert . equal ( item , 0 ) ;
110+ } ) )
111+ pool . checkOut ( assert . calls ( function ( err , item ) {
112+ assert . equal ( item , 1 ) ;
113+ } ) )
114+ pool . checkOut ( assert . calls ( function ( err , item ) {
115+ assert . equal ( item , 2 ) ;
112116 } ) )
113117 } )
114118} )
@@ -167,7 +171,7 @@ test('normalizing connection info', function() {
167171 assert . equal ( output . database , process . env . USER ) ;
168172 assert . equal ( output . port , 5432 ) ;
169173 } ) ;
170-
174+
171175 test ( 'uses overridden defaults' , function ( ) {
172176 defaults . host = "/var/run/postgresql" ;
173177 defaults . user = "boom" ;
0 commit comments