@@ -185,23 +185,32 @@ describe('ErrsolePostgres', () => {
185
185
186
186
describe ( '#createTables' , ( ) => {
187
187
it ( 'should create necessary tables' , async ( ) => {
188
+ // Mock the query method to resolve for all calls
188
189
poolMock . query . mockResolvedValue ( { } ) ;
189
190
191
+ // Call the function
190
192
await errsolePostgres . createTables ( ) ;
191
193
192
- const createTableCalls = [
193
- expect . stringContaining ( 'CREATE TABLE IF NOT EXISTS errsole_logs_v2' ) ,
194
- expect . stringContaining ( 'CREATE INDEX IF NOT EXISTS errsole_logs_v2_source_level_id_idx' ) ,
195
- expect . stringContaining ( 'CREATE INDEX IF NOT EXISTS errsole_logs_v2_source_level_timestamp_idx' ) ,
196
- expect . stringContaining ( 'CREATE INDEX IF NOT EXISTS errsole_logs_v2_hostname_pid_id_idx' ) ,
197
- expect . stringContaining ( 'CREATE TABLE IF NOT EXISTS errsole_users' ) ,
198
- expect . stringContaining ( 'CREATE TABLE IF NOT EXISTS errsole_config' )
194
+ // Capture all queries executed
195
+ const executedQueries = poolMock . query . mock . calls . map ( call => call [ 0 ] ) ;
196
+ // Define expected table creation queries
197
+ const expectedQueries = [
198
+ / C R E A T E T A B L E I F N O T E X I S T S e r r s o l e _ l o g s _ v 3 / ,
199
+ / C R E A T E I N D E X I F N O T E X I S T S .* e r r s o l e _ l o g s _ v 3 .* h o s t n a m e .* s o u r c e .* l e v e l .* t i m e s t a m p .* i d / ,
200
+ / C R E A T E I N D E X I F N O T E X I S T S .* e r r s o l e _ l o g s _ v 3 .* h o s t n a m e .* t i m e s t a m p .* i d / ,
201
+ / C R E A T E I N D E X I F N O T E X I S T S .* e r r s o l e _ l o g s _ v 3 .* h o s t n a m e / ,
202
+ / C R E A T E I N D E X I F N O T E X I S T S .* e r r s o l e _ l o g s _ v 3 .* t i m e s t a m p .* i d / ,
203
+ / C R E A T E I N D E X I F N O T E X I S T S .* e r r s o l e _ l o g s _ v 3 .* e r r s o l e _ i d / ,
204
+ / C R E A T E T A B L E I F N O T E X I S T S e r r s o l e _ u s e r s / ,
205
+ / C R E A T E T A B L E I F N O T E X I S T S e r r s o l e _ c o n f i g /
199
206
] ;
200
207
201
- createTableCalls . forEach ( call => {
202
- expect ( poolMock . query ) . toHaveBeenCalledWith ( call ) ;
208
+ // Ensure all expected queries were executed
209
+ expectedQueries . forEach ( expectedQuery => {
210
+ expect ( executedQueries . some ( query => expectedQuery . test ( query ) ) ) . toBe ( true ) ;
203
211
} ) ;
204
212
} ) ;
213
+
205
214
it ( 'should throw an error if table creation fails' , async ( ) => {
206
215
const error = new Error ( 'Query error' ) ;
207
216
poolMock . query . mockRejectedValueOnce ( error ) ;
@@ -594,52 +603,12 @@ describe('ErrsolePostgres', () => {
594
603
const result = await errsolePostgres . getLogs ( ) ;
595
604
596
605
expect ( poolMock . query ) . toHaveBeenCalledWith (
597
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 ' ) ,
606
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 ' ) ,
598
607
[ 100 ]
599
608
) ;
600
609
expect ( result ) . toEqual ( { items : logs } ) ;
601
610
} ) ;
602
611
603
- it ( 'should apply hostname and pid filters' , async ( ) => {
604
- const logs = [
605
- { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : new Date ( ) , level : 'info' , message : 'test message' }
606
- ] ;
607
- const filters = {
608
- hostname : 'localhost' ,
609
- pid : 1234 ,
610
- limit : 50
611
- } ;
612
- poolMock . query . mockResolvedValueOnce ( { rows : logs } ) ;
613
-
614
- const result = await errsolePostgres . getLogs ( filters ) ;
615
-
616
- expect ( poolMock . query ) . toHaveBeenCalledWith (
617
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE hostname = $1 AND pid = $2 ORDER BY id DESC LIMIT $3' ) ,
618
- [ 'localhost' , 1234 , 50 ]
619
- ) ;
620
- expect ( result ) . toEqual ( { items : logs } ) ;
621
- } ) ;
622
-
623
- it ( 'should apply sources and levels filters' , async ( ) => {
624
- const logs = [
625
- { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : new Date ( ) , level : 'info' , message : 'test message' }
626
- ] ;
627
- const filters = {
628
- sources : [ 'test' ] ,
629
- levels : [ 'info' ] ,
630
- limit : 50
631
- } ;
632
- poolMock . query . mockResolvedValueOnce ( { rows : logs } ) ;
633
-
634
- const result = await errsolePostgres . getLogs ( filters ) ;
635
-
636
- expect ( poolMock . query ) . toHaveBeenCalledWith (
637
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE source = ANY($1) AND level = ANY($2) ORDER BY id DESC LIMIT $3' ) ,
638
- [ [ 'test' ] , [ 'info' ] , 50 ]
639
- ) ;
640
- expect ( result ) . toEqual ( { items : logs } ) ;
641
- } ) ;
642
-
643
612
it ( 'should apply lt_id filter' , async ( ) => {
644
613
const logs = [
645
614
{ id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : new Date ( ) , level : 'info' , message : 'test message' }
@@ -653,7 +622,7 @@ describe('ErrsolePostgres', () => {
653
622
const result = await errsolePostgres . getLogs ( filters ) ;
654
623
655
624
expect ( poolMock . query ) . toHaveBeenCalledWith (
656
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE id < $1 ORDER BY id DESC LIMIT $2' ) ,
625
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 WHERE id < $1 ORDER BY id DESC LIMIT $2' ) ,
657
626
[ 10 , 50 ]
658
627
) ;
659
628
expect ( result ) . toEqual ( { items : logs } ) ;
@@ -672,7 +641,7 @@ describe('ErrsolePostgres', () => {
672
641
const result = await errsolePostgres . getLogs ( filters ) ;
673
642
674
643
expect ( poolMock . query ) . toHaveBeenCalledWith (
675
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE id > $1 ORDER BY id ASC LIMIT $2' ) ,
644
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 WHERE id > $1 ORDER BY id ASC LIMIT $2' ) ,
676
645
[ 5 , 50 ]
677
646
) ;
678
647
expect ( result ) . toEqual ( { items : logs } ) ;
@@ -686,54 +655,56 @@ describe('ErrsolePostgres', () => {
686
655
lte_timestamp : new Date ( '2023-01-02T00:00:00Z' ) ,
687
656
limit : 50
688
657
} ;
658
+
689
659
poolMock . query . mockResolvedValueOnce ( { rows : logs } ) ;
690
660
691
661
const result = await errsolePostgres . getLogs ( filters ) ;
692
662
693
663
expect ( poolMock . query ) . toHaveBeenCalledWith (
694
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE timestamp <= $1 ORDER BY id DESC LIMIT $2' ) ,
664
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 WHERE timestamp <= $1 ORDER BY timestamp DESC, id DESC LIMIT $2' ) ,
695
665
[ new Date ( '2023-01-02T00:00:00Z' ) , 50 ]
696
666
) ;
697
667
expect ( result ) . toEqual ( { items : logs } ) ;
698
668
} ) ;
699
669
700
- it ( 'should apply level_json filter' , async ( ) => {
670
+ it ( 'should apply gte_timestamp filter' , async ( ) => {
701
671
const logs = [
702
- { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : new Date ( ) , level : 'info' , message : 'test message' }
672
+ { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : new Date ( '2023-01-01T00:00:00Z' ) , level : 'info' , message : 'test message' }
703
673
] ;
704
674
const filters = {
705
- level_json : [
706
- { source : 'test' , level : 'info' } ,
707
- { source : 'another_test' , level : 'warn' }
708
- ] ,
675
+ gte_timestamp : new Date ( '2023-01-01T00:00:00Z' ) ,
709
676
limit : 50
710
677
} ;
678
+
711
679
poolMock . query . mockResolvedValueOnce ( { rows : logs } ) ;
712
680
713
681
const result = await errsolePostgres . getLogs ( filters ) ;
714
682
715
683
expect ( poolMock . query ) . toHaveBeenCalledWith (
716
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 ' ) ,
717
- expect . arrayContaining ( [ 'test' , 'info' , 'another_test' , 'warn' , 50 ] )
684
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 WHERE timestamp >= $1 ORDER BY timestamp ASC, id ASC LIMIT $2 ' ) ,
685
+ [ new Date ( '2023-01-01T00:00:00Z' ) , 50 ]
718
686
) ;
719
687
expect ( result ) . toEqual ( { items : logs } ) ;
720
688
} ) ;
721
689
722
- it ( 'should apply gte_timestamp filter' , async ( ) => {
690
+ it ( 'should apply level_json filter' , async ( ) => {
723
691
const logs = [
724
- { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : new Date ( '2023-01-01T00:00:00Z' ) , level : 'info' , message : 'test message' }
692
+ { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : new Date ( ) , level : 'info' , message : 'test message' }
725
693
] ;
726
694
const filters = {
727
- gte_timestamp : new Date ( '2023-01-01T00:00:00Z' ) ,
695
+ level_json : [
696
+ { source : 'test' , level : 'info' } ,
697
+ { source : 'another_test' , level : 'warn' }
698
+ ] ,
728
699
limit : 50
729
700
} ;
730
701
poolMock . query . mockResolvedValueOnce ( { rows : logs } ) ;
731
702
732
703
const result = await errsolePostgres . getLogs ( filters ) ;
733
704
734
705
expect ( poolMock . query ) . toHaveBeenCalledWith (
735
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE timestamp >= $1 ORDER BY id ASC LIMIT $2 ' ) ,
736
- [ new Date ( '2023-01-01T00:00:00Z' ) , 50 ]
706
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 ' ) ,
707
+ expect . arrayContaining ( [ 'test' , 'info' , 'another_test' , 'warn' , 50 ] )
737
708
) ;
738
709
expect ( result ) . toEqual ( { items : logs } ) ;
739
710
} ) ;
@@ -752,7 +723,7 @@ describe('ErrsolePostgres', () => {
752
723
const result = await errsolePostgres . getLogs ( filters ) ;
753
724
754
725
expect ( poolMock . query ) . toHaveBeenCalledWith (
755
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE id < $1 ORDER BY id DESC LIMIT $2' ) ,
726
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 WHERE id < $1 ORDER BY id DESC LIMIT $2' ) ,
756
727
[ 10 , 50 ]
757
728
) ;
758
729
expect ( result . items ) . toEqual ( logs . reverse ( ) ) ;
@@ -885,7 +856,7 @@ describe('ErrsolePostgres', () => {
885
856
await expect ( errsolePostgres . getLogs ( ) ) . rejects . toThrow ( 'Query error' ) ;
886
857
887
858
expect ( poolMock . query ) . toHaveBeenCalledWith (
888
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 ' ) ,
859
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 ' ) ,
889
860
[ 100 ]
890
861
) ;
891
862
} ) ;
@@ -910,7 +881,7 @@ describe('ErrsolePostgres', () => {
910
881
911
882
expect ( poolQuerySpy ) . toHaveBeenCalledWith (
912
883
expect . stringContaining (
913
- 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE ('
884
+ 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 WHERE ('
914
885
) ,
915
886
expect . arrayContaining ( [ 'source1' , 'info' , 'source2' , 'error' , 50 ] )
916
887
) ;
@@ -932,7 +903,7 @@ describe('ErrsolePostgres', () => {
932
903
const result = await errsolePostgres . getLogs ( filters ) ;
933
904
934
905
expect ( poolQuerySpy ) . toHaveBeenCalledWith (
935
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE (' ) ,
906
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 WHERE (' ) ,
936
907
expect . arrayContaining ( [ 123 , 50 ] )
937
908
) ;
938
909
expect ( result . items ) . toEqual ( logs ) ;
@@ -956,7 +927,7 @@ describe('ErrsolePostgres', () => {
956
927
const result = await errsolePostgres . getLogs ( filters ) ;
957
928
958
929
expect ( poolQuerySpy ) . toHaveBeenCalledWith (
959
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE (' ) ,
930
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 WHERE (' ) ,
960
931
expect . arrayContaining ( [ 'source1' , 'info' , 123 , 50 ] )
961
932
) ;
962
933
expect ( result . items ) . toEqual ( logs ) ;
@@ -976,7 +947,7 @@ describe('ErrsolePostgres', () => {
976
947
const result = await errsolePostgres . getLogs ( filters ) ;
977
948
978
949
expect ( poolQuerySpy ) . toHaveBeenCalledWith (
979
- expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v2 WHERE (' ) ,
950
+ expect . stringContaining ( 'SELECT id, hostname, pid, source, timestamp, level, message, errsole_id FROM errsole_logs_v3 WHERE (' ) ,
980
951
expect . arrayContaining ( [ 'source1' , 'info' , 123 , 50 ] )
981
952
) ;
982
953
expect ( result . items ) . toEqual ( [ ] ) ;
@@ -1013,82 +984,6 @@ describe('ErrsolePostgres', () => {
1013
984
) ;
1014
985
} ) ;
1015
986
1016
- it ( 'should search log entries with hostname filter' , async ( ) => {
1017
- poolMock . query . mockResolvedValueOnce ( {
1018
- rows : [
1019
- { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : '2023-01-01T00:00:00Z' , level : 'info' , message : 'test message' }
1020
- ]
1021
- } ) ;
1022
-
1023
- const logs = await errsolePostgres . searchLogs ( [ 'test' ] , { hostname : 'localhost' } ) ;
1024
-
1025
- expect ( logs ) . toEqual ( {
1026
- items : [ { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : '2023-01-01T00:00:00Z' , level : 'info' , message : 'test message' } ] ,
1027
- filters : { hostname : 'localhost' , limit : 100 }
1028
- } ) ;
1029
- expect ( poolMock . query ) . toHaveBeenCalledWith (
1030
- expect . any ( String ) ,
1031
- expect . arrayContaining ( [ '%test%' , 'localhost' ] )
1032
- ) ;
1033
- } ) ;
1034
-
1035
- it ( 'should search log entries with pid filter' , async ( ) => {
1036
- poolMock . query . mockResolvedValueOnce ( {
1037
- rows : [
1038
- { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : '2023-01-01T00:00:00Z' , level : 'info' , message : 'test message' }
1039
- ]
1040
- } ) ;
1041
-
1042
- const logs = await errsolePostgres . searchLogs ( [ 'test' ] , { pid : 1234 } ) ;
1043
-
1044
- expect ( logs ) . toEqual ( {
1045
- items : [ { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : '2023-01-01T00:00:00Z' , level : 'info' , message : 'test message' } ] ,
1046
- filters : { pid : 1234 , limit : 100 }
1047
- } ) ;
1048
- expect ( poolMock . query ) . toHaveBeenCalledWith (
1049
- expect . any ( String ) ,
1050
- expect . arrayContaining ( [ '%test%' , 1234 ] )
1051
- ) ;
1052
- } ) ;
1053
-
1054
- it ( 'should search log entries with sources filter' , async ( ) => {
1055
- poolMock . query . mockResolvedValueOnce ( {
1056
- rows : [
1057
- { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : '2023-01-01T00:00:00Z' , level : 'info' , message : 'test message' }
1058
- ]
1059
- } ) ;
1060
-
1061
- const logs = await errsolePostgres . searchLogs ( [ 'test' ] , { sources : [ 'test' ] } ) ;
1062
-
1063
- expect ( logs ) . toEqual ( {
1064
- items : [ { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : '2023-01-01T00:00:00Z' , level : 'info' , message : 'test message' } ] ,
1065
- filters : { sources : [ 'test' ] , limit : 100 }
1066
- } ) ;
1067
- expect ( poolMock . query ) . toHaveBeenCalledWith (
1068
- expect . any ( String ) ,
1069
- expect . arrayContaining ( [ '%test%' , [ 'test' ] ] )
1070
- ) ;
1071
- } ) ;
1072
-
1073
- it ( 'should search log entries with levels filter' , async ( ) => {
1074
- poolMock . query . mockResolvedValueOnce ( {
1075
- rows : [
1076
- { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : '2023-01-01T00:00:00Z' , level : 'info' , message : 'test message' }
1077
- ]
1078
- } ) ;
1079
-
1080
- const logs = await errsolePostgres . searchLogs ( [ 'test' ] , { levels : [ 'info' ] } ) ;
1081
-
1082
- expect ( logs ) . toEqual ( {
1083
- items : [ { id : 1 , hostname : 'localhost' , pid : 1234 , source : 'test' , timestamp : '2023-01-01T00:00:00Z' , level : 'info' , message : 'test message' } ] ,
1084
- filters : { levels : [ 'info' ] , limit : 100 }
1085
- } ) ;
1086
- expect ( poolMock . query ) . toHaveBeenCalledWith (
1087
- expect . any ( String ) ,
1088
- expect . arrayContaining ( [ '%test%' , [ 'info' ] ] )
1089
- ) ;
1090
- } ) ;
1091
-
1092
987
it ( 'should search log entries with level_json filter' , async ( ) => {
1093
988
poolMock . query . mockResolvedValueOnce ( {
1094
989
rows : [
@@ -1399,7 +1294,7 @@ describe('ErrsolePostgres', () => {
1399
1294
const result = await errsolePostgres . searchLogs ( [ ] , filters ) ;
1400
1295
1401
1296
expect ( poolQuerySpy ) . toHaveBeenCalledWith (
1402
- 'SELECT id, hostname, pid, source, timestamp, level, message,errsole_id FROM errsole_logs_v2 WHERE (errsole_id = $1) ORDER BY id DESC LIMIT $1' ,
1297
+ 'SELECT id, hostname, pid, source, timestamp, level, message,errsole_id FROM errsole_logs_v3 WHERE (errsole_id = $1) ORDER BY id DESC LIMIT $1' ,
1403
1298
[ 123 , 50 ]
1404
1299
) ;
1405
1300
@@ -1443,7 +1338,7 @@ describe('ErrsolePostgres', () => {
1443
1338
1444
1339
const result = await errsolePostgres . getMeta ( 1 ) ;
1445
1340
1446
- expect ( poolMock . query ) . toHaveBeenCalledWith ( 'SELECT id, meta FROM errsole_logs_v2 WHERE id = $1' , [ 1 ] ) ;
1341
+ expect ( poolMock . query ) . toHaveBeenCalledWith ( 'SELECT id, meta FROM errsole_logs_v3 WHERE id = $1' , [ 1 ] ) ;
1447
1342
expect ( result ) . toEqual ( { item : logMeta } ) ;
1448
1343
} ) ;
1449
1344
@@ -1452,7 +1347,7 @@ describe('ErrsolePostgres', () => {
1452
1347
1453
1348
await expect ( errsolePostgres . getMeta ( 999 ) ) . rejects . toThrow ( 'Log entry not found.' ) ;
1454
1349
1455
- expect ( poolMock . query ) . toHaveBeenCalledWith ( 'SELECT id, meta FROM errsole_logs_v2 WHERE id = $1' , [ 999 ] ) ;
1350
+ expect ( poolMock . query ) . toHaveBeenCalledWith ( 'SELECT id, meta FROM errsole_logs_v3 WHERE id = $1' , [ 999 ] ) ;
1456
1351
} ) ;
1457
1352
1458
1353
it ( 'should handle errors during query execution' , async ( ) => {
@@ -1461,7 +1356,7 @@ describe('ErrsolePostgres', () => {
1461
1356
1462
1357
await expect ( errsolePostgres . getMeta ( 1 ) ) . rejects . toThrow ( 'Query error' ) ;
1463
1358
1464
- expect ( poolMock . query ) . toHaveBeenCalledWith ( 'SELECT id, meta FROM errsole_logs_v2 WHERE id = $1' , [ 1 ] ) ;
1359
+ expect ( poolMock . query ) . toHaveBeenCalledWith ( 'SELECT id, meta FROM errsole_logs_v3 WHERE id = $1' , [ 1 ] ) ;
1465
1360
} ) ;
1466
1361
} ) ;
1467
1362
@@ -1980,7 +1875,7 @@ describe('ErrsolePostgres', () => {
1980
1875
1981
1876
const result = await errsolePostgres . deleteAllLogs ( ) ;
1982
1877
1983
- expect ( poolQuerySpy ) . toHaveBeenCalledWith ( 'TRUNCATE TABLE errsole_logs_v2 RESTART IDENTITY CASCADE' ) ;
1878
+ expect ( poolQuerySpy ) . toHaveBeenCalledWith ( 'TRUNCATE TABLE errsole_logs_v3 RESTART IDENTITY CASCADE' ) ;
1984
1879
expect ( result ) . toEqual ( { } ) ;
1985
1880
} ) ;
1986
1881
@@ -1990,7 +1885,7 @@ describe('ErrsolePostgres', () => {
1990
1885
1991
1886
await expect ( errsolePostgres . deleteAllLogs ( ) ) . rejects . toThrow ( 'Query error' ) ;
1992
1887
1993
- expect ( poolQuerySpy ) . toHaveBeenCalledWith ( 'TRUNCATE TABLE errsole_logs_v2 RESTART IDENTITY CASCADE' ) ;
1888
+ expect ( poolQuerySpy ) . toHaveBeenCalledWith ( 'TRUNCATE TABLE errsole_logs_v3 RESTART IDENTITY CASCADE' ) ;
1994
1889
} ) ;
1995
1890
} ) ;
1996
1891
afterAll ( ( ) => {
0 commit comments