@@ -4,7 +4,8 @@ import { afterEach, describe, it } from 'node:test';
4
4
import path from 'path' ;
5
5
import { fileURLToPath } from 'url' ;
6
6
import { SQL } from '../../../../core' ;
7
- import { InMemorySQLiteDatabase , sqlitePool } from '../../core' ;
7
+ import { sqlite3Pool } from '../../../../sqlite3' ;
8
+ import { InMemorySQLiteDatabase } from '../../core' ;
8
9
import { sqlite3Client } from './connection' ;
9
10
10
11
void describe ( 'Node SQLite pool' , ( ) => {
@@ -35,7 +36,7 @@ void describe('Node SQLite pool', () => {
35
36
36
37
void describe ( `in-memory database` , ( ) => {
37
38
void it ( 'returns the singleton connection' , async ( ) => {
38
- const pool = sqlitePool ( {
39
+ const pool = sqlite3Pool ( {
39
40
driverType : 'SQLite:sqlite3' ,
40
41
fileName : inMemoryfileName ,
41
42
} ) ;
@@ -58,7 +59,10 @@ void describe('Node SQLite pool', () => {
58
59
59
60
void describe ( `file-based database` , ( ) => {
60
61
void it ( 'returns the new connection each time' , async ( ) => {
61
- const pool = sqlitePool ( { driverType : 'SQLite:sqlite3' , fileName } ) ;
62
+ const pool = sqlite3Pool ( {
63
+ driverType : 'SQLite:sqlite3' ,
64
+ fileName,
65
+ } ) ;
62
66
const connection = await pool . connection ( ) ;
63
67
const otherConnection = await pool . connection ( ) ;
64
68
@@ -76,7 +80,7 @@ void describe('Node SQLite pool', () => {
76
80
} ) ;
77
81
78
82
void it ( 'for singleton setting returns the singleton connection' , async ( ) => {
79
- const pool = sqlitePool ( {
83
+ const pool = sqlite3Pool ( {
80
84
driverType : 'SQLite:sqlite3' ,
81
85
fileName,
82
86
singleton : true ,
@@ -99,9 +103,12 @@ void describe('Node SQLite pool', () => {
99
103
} ) ;
100
104
101
105
for ( const { testName, fileName } of testCases ) {
102
- void describe ( `sqlitePool with ${ testName } database` , ( ) => {
106
+ void describe ( `sqlite3Pool with ${ testName } database` , ( ) => {
103
107
void it ( 'connects using default pool' , async ( ) => {
104
- const pool = sqlitePool ( { driverType : 'SQLite:sqlite3' , fileName } ) ;
108
+ const pool = sqlite3Pool ( {
109
+ driverType : 'SQLite:sqlite3' ,
110
+ fileName,
111
+ } ) ;
105
112
const connection = await pool . connection ( ) ;
106
113
107
114
try {
@@ -116,7 +123,7 @@ void describe('Node SQLite pool', () => {
116
123
} ) ;
117
124
118
125
void it ( 'connects using client' , async ( ) => {
119
- const pool = sqlitePool ( {
126
+ const pool = sqlite3Pool ( {
120
127
driverType : 'SQLite:sqlite3' ,
121
128
fileName,
122
129
pooled : false ,
@@ -135,7 +142,7 @@ void describe('Node SQLite pool', () => {
135
142
const existingClient = sqlite3Client ( { fileName } ) ;
136
143
await existingClient . connect ( ) ;
137
144
138
- const pool = sqlitePool ( {
145
+ const pool = sqlite3Pool ( {
139
146
driverType : 'SQLite:sqlite3' ,
140
147
fileName,
141
148
client : existingClient ,
@@ -152,14 +159,14 @@ void describe('Node SQLite pool', () => {
152
159
} ) ;
153
160
154
161
void it ( 'connects using connected ambient connected connection' , async ( ) => {
155
- const ambientPool = sqlitePool ( {
162
+ const ambientPool = sqlite3Pool ( {
156
163
driverType : 'SQLite:sqlite3' ,
157
164
fileName,
158
165
} ) ;
159
166
const ambientConnection = await ambientPool . connection ( ) ;
160
167
await ambientConnection . open ( ) ;
161
168
162
- const pool = sqlitePool ( {
169
+ const pool = sqlite3Pool ( {
163
170
driverType : 'SQLite:sqlite3' ,
164
171
fileName,
165
172
connection : ambientConnection ,
@@ -175,13 +182,13 @@ void describe('Node SQLite pool', () => {
175
182
} ) ;
176
183
177
184
void it ( 'connects using connected ambient not-connected connection' , async ( ) => {
178
- const ambientPool = sqlitePool ( {
185
+ const ambientPool = sqlite3Pool ( {
179
186
driverType : 'SQLite:sqlite3' ,
180
187
fileName,
181
188
} ) ;
182
189
const ambientConnection = await ambientPool . connection ( ) ;
183
190
184
- const pool = sqlitePool ( {
191
+ const pool = sqlite3Pool ( {
185
192
driverType : 'SQLite:sqlite3' ,
186
193
fileName,
187
194
connection : ambientConnection ,
@@ -197,7 +204,7 @@ void describe('Node SQLite pool', () => {
197
204
} ) ;
198
205
199
206
void it ( 'connects using ambient connected connection with transaction' , async ( ) => {
200
- const ambientPool = sqlitePool ( {
207
+ const ambientPool = sqlite3Pool ( {
201
208
driverType : 'SQLite:sqlite3' ,
202
209
fileName,
203
210
} ) ;
@@ -206,7 +213,7 @@ void describe('Node SQLite pool', () => {
206
213
207
214
try {
208
215
await ambientConnection . withTransaction < void > ( async ( ) => {
209
- const pool = sqlitePool ( {
216
+ const pool = sqlite3Pool ( {
210
217
driverType : 'SQLite:sqlite3' ,
211
218
fileName,
212
219
connection : ambientConnection ,
@@ -226,15 +233,15 @@ void describe('Node SQLite pool', () => {
226
233
} ) ;
227
234
228
235
void it ( 'connects using ambient not-connected connection with transaction' , async ( ) => {
229
- const ambientPool = sqlitePool ( {
236
+ const ambientPool = sqlite3Pool ( {
230
237
driverType : 'SQLite:sqlite3' ,
231
238
fileName,
232
239
} ) ;
233
240
const ambientConnection = await ambientPool . connection ( ) ;
234
241
235
242
try {
236
243
await ambientConnection . withTransaction < void > ( async ( ) => {
237
- const pool = sqlitePool ( {
244
+ const pool = sqlite3Pool ( {
238
245
driverType : 'SQLite:sqlite3' ,
239
246
fileName,
240
247
connection : ambientConnection ,
@@ -254,13 +261,13 @@ void describe('Node SQLite pool', () => {
254
261
} ) ;
255
262
256
263
void it ( 'connects using ambient connection in withConnection scope' , async ( ) => {
257
- const ambientPool = sqlitePool ( {
264
+ const ambientPool = sqlite3Pool ( {
258
265
driverType : 'SQLite:sqlite3' ,
259
266
fileName,
260
267
} ) ;
261
268
try {
262
269
await ambientPool . withConnection ( async ( ambientConnection ) => {
263
- const pool = sqlitePool ( {
270
+ const pool = sqlite3Pool ( {
264
271
driverType : 'SQLite:sqlite3' ,
265
272
fileName,
266
273
connection : ambientConnection ,
@@ -279,14 +286,14 @@ void describe('Node SQLite pool', () => {
279
286
} ) ;
280
287
281
288
void it ( 'connects using ambient connection in withConnection and withTransaction scope' , async ( ) => {
282
- const ambientPool = sqlitePool ( {
289
+ const ambientPool = sqlite3Pool ( {
283
290
driverType : 'SQLite:sqlite3' ,
284
291
fileName,
285
292
} ) ;
286
293
try {
287
294
await ambientPool . withConnection ( ( ambientConnection ) =>
288
295
ambientConnection . withTransaction < void > ( async ( ) => {
289
- const pool = sqlitePool ( {
296
+ const pool = sqlite3Pool ( {
290
297
driverType : 'SQLite:sqlite3' ,
291
298
fileName,
292
299
connection : ambientConnection ,
0 commit comments