Skip to content

Commit 0960559

Browse files
committed
Moving pool tests to
1 parent beab63c commit 0960559

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

packages/neo4j-driver/test/internal/pool.test.js renamed to packages/bolt-connection/test/pool/pool.test.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
* limitations under the License.
1818
*/
1919

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'
2222
import { newError, error, internal } from 'neo4j-driver-core'
2323

2424
const {
@@ -27,7 +27,7 @@ const {
2727

2828
const { SERVICE_UNAVAILABLE } = error
2929

30-
describe('#unit Pool', async () => {
30+
describe('#unit Pool', () => {
3131
it('allocates if pool is empty', async () => {
3232
// Given
3333
let counter = 0
@@ -282,11 +282,9 @@ describe('#unit Pool', async () => {
282282
// Close the pool
283283
await pool.close()
284284

285-
await expectAsync(pool.acquire(address)).toBeRejectedWith(
286-
jasmine.objectContaining({
287-
message: jasmine.stringMatching(/Pool is closed/)
288-
})
289-
)
285+
await expect(pool.acquire(address)).rejects.toMatchObject({
286+
message: expect.stringMatching('Pool is closed')
287+
})
290288
})
291289

292290
it('should fail to acquire when closed with idle connections', async () => {
@@ -307,11 +305,9 @@ describe('#unit Pool', async () => {
307305
// Close the pool
308306
await pool.close()
309307

310-
await expectAsync(pool.acquire(address)).toBeRejectedWith(
311-
jasmine.objectContaining({
312-
message: jasmine.stringMatching(/Pool is closed/)
313-
})
314-
)
308+
await expect(pool.acquire(address)).rejects.toMatchObject({
309+
message: expect.stringMatching('Pool is closed')
310+
})
315311
})
316312
it('purges keys other than the ones to keep', async () => {
317313
let counter = 0
@@ -561,9 +557,9 @@ describe('#unit Pool', async () => {
561557
await pool.acquire(address)
562558
await pool.acquire(address)
563559

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+
})
567563
expectNumberOfAcquisitionRequests(pool, address, 0)
568564
})
569565

@@ -607,11 +603,11 @@ describe('#unit Pool', async () => {
607603

608604
// Let's fulfill the connect promise belonging to the first request.
609605
conns[0].resolve(conns[0])
610-
await expectAsync(req1).toBeResolved()
606+
await expect(req1).resolves.toBeDefined()
611607

612608
// Release the connection, it should be picked up by the second request.
613609
conns[0].release(address, conns[0])
614-
await expectAsync(req2).toBeResolved()
610+
await expect(req2).resolves.toBeDefined()
615611

616612
// Just to make sure that there hasn't been any new connection.
617613
expect(conns.length).toEqual(1)

0 commit comments

Comments
 (0)