@@ -10,13 +10,21 @@ describe('InsightsModulePreInit', () => {
10
10
it ( 'should return false if instance type is not "main"' , ( ) => {
11
11
const ctx : ModulePreInitContext = {
12
12
instance : mock < InstanceSettings > ( { instanceType : 'worker' } ) ,
13
- database : mock < DatabaseConfig > ( { type : 'sqlite' } ) ,
13
+ database : mock < DatabaseConfig > ( { type : 'sqlite' , sqlite : { poolSize : 10 } } ) ,
14
14
} ;
15
15
expect ( shouldLoadModule ( ctx ) ) . toBe ( false ) ;
16
16
} ) ;
17
17
18
- it . each ( [ 'postgresdb' , 'mariadb' , 'mysqldb' , 'sqlite' ] ) (
19
- 'should return true if instance type is "main"' ,
18
+ it ( 'should return false if database type is "sqlite" and poolSize is < 1' , ( ) => {
19
+ const ctx : ModulePreInitContext = {
20
+ instance : mock < InstanceSettings > ( { instanceType : 'main' } ) ,
21
+ database : mock < DatabaseConfig > ( { type : 'sqlite' , sqlite : { poolSize : 0 } } ) ,
22
+ } ;
23
+ expect ( shouldLoadModule ( ctx ) ) . toBe ( false ) ;
24
+ } ) ;
25
+
26
+ it . each ( [ 'postgresdb' , 'mariadb' , 'mysqldb' ] ) (
27
+ 'should return true if instance type is "main" and database is not sqlite' ,
20
28
( dbType : 'postgresdb' | 'mysqldb' | 'sqlite' | 'mariadb' ) => {
21
29
const ctx : ModulePreInitContext = {
22
30
instance : mock < InstanceSettings > ( { instanceType : 'main' } ) ,
@@ -25,4 +33,12 @@ describe('InsightsModulePreInit', () => {
25
33
expect ( shouldLoadModule ( ctx ) ) . toBe ( true ) ;
26
34
} ,
27
35
) ;
36
+
37
+ it ( 'should return true if instance type is "main" and sqlite poolSize is >= 1' , ( ) => {
38
+ const ctx : ModulePreInitContext = {
39
+ instance : mock < InstanceSettings > ( { instanceType : 'main' } ) ,
40
+ database : mock < DatabaseConfig > ( { type : 'sqlite' , sqlite : { poolSize : 1 } } ) ,
41
+ } ;
42
+ expect ( shouldLoadModule ( ctx ) ) . toBe ( true ) ;
43
+ } ) ;
28
44
} ) ;
0 commit comments