17
17
* limitations under the License.
18
18
*/
19
19
20
- import Pool from '../../../bolt-connection/lib /pool/pool'
21
- import PoolConfig from '../../../bolt-connection/lib /pool/pool-config'
20
+ import Pool from '../../src /pool/pool'
21
+ import PoolConfig from '../../src /pool/pool-config'
22
22
import { newError , error , internal } from 'neo4j-driver-core'
23
23
24
24
const {
@@ -27,7 +27,7 @@ const {
27
27
28
28
const { SERVICE_UNAVAILABLE } = error
29
29
30
- describe ( '#unit Pool' , async ( ) => {
30
+ describe ( '#unit Pool' , ( ) => {
31
31
it ( 'allocates if pool is empty' , async ( ) => {
32
32
// Given
33
33
let counter = 0
@@ -282,11 +282,9 @@ describe('#unit Pool', async () => {
282
282
// Close the pool
283
283
await pool . close ( )
284
284
285
- await expectAsync ( pool . acquire ( address ) ) . toBeRejectedWith (
286
- jasmine . objectContaining ( {
287
- message : jasmine . stringMatching ( / P o o l i s c l o s e d / )
288
- } )
289
- )
285
+ await expect ( pool . acquire ( address ) ) . rejects . toMatchObject ( {
286
+ message : expect . stringMatching ( 'Pool is closed' )
287
+ } )
290
288
} )
291
289
292
290
it ( 'should fail to acquire when closed with idle connections' , async ( ) => {
@@ -307,11 +305,9 @@ describe('#unit Pool', async () => {
307
305
// Close the pool
308
306
await pool . close ( )
309
307
310
- await expectAsync ( pool . acquire ( address ) ) . toBeRejectedWith (
311
- jasmine . objectContaining ( {
312
- message : jasmine . stringMatching ( / P o o l i s c l o s e d / )
313
- } )
314
- )
308
+ await expect ( pool . acquire ( address ) ) . rejects . toMatchObject ( {
309
+ message : expect . stringMatching ( 'Pool is closed' )
310
+ } )
315
311
} )
316
312
it ( 'purges keys other than the ones to keep' , async ( ) => {
317
313
let counter = 0
@@ -561,9 +557,9 @@ describe('#unit Pool', async () => {
561
557
await pool . acquire ( address )
562
558
await pool . acquire ( address )
563
559
564
- await expectAsync ( pool . acquire ( address ) ) . toBeRejectedWith (
565
- jasmine . stringMatching ( 'acquisition timed out' )
566
- )
560
+ await expect ( pool . acquire ( address ) ) . rejects . toMatchObject ( {
561
+ message : expect . stringMatching ( 'acquisition timed out' )
562
+ } )
567
563
expectNumberOfAcquisitionRequests ( pool , address , 0 )
568
564
} )
569
565
@@ -607,11 +603,11 @@ describe('#unit Pool', async () => {
607
603
608
604
// Let's fulfill the connect promise belonging to the first request.
609
605
conns [ 0 ] . resolve ( conns [ 0 ] )
610
- await expectAsync ( req1 ) . toBeResolved ( )
606
+ await expect ( req1 ) . resolves . toBeDefined ( )
611
607
612
608
// Release the connection, it should be picked up by the second request.
613
609
conns [ 0 ] . release ( address , conns [ 0 ] )
614
- await expectAsync ( req2 ) . toBeResolved ( )
610
+ await expect ( req2 ) . resolves . toBeDefined ( )
615
611
616
612
// Just to make sure that there hasn't been any new connection.
617
613
expect ( conns . length ) . toEqual ( 1 )
0 commit comments