File tree Expand file tree Collapse file tree 2 files changed +1
-26
lines changed Expand file tree Collapse file tree 2 files changed +1
-26
lines changed Original file line number Diff line number Diff line change @@ -1962,31 +1962,6 @@ describe('ErrsolePostgres', () => {
1962
1962
} ) ;
1963
1963
} ) ;
1964
1964
1965
- describe ( '#DeleteAllLogs' , ( ) => {
1966
- it ( 'should successfully truncate the logs table' , async ( ) => {
1967
- const truncateQuery = `TRUNCATE TABLE ${ errsolePostgres . logsTable } RESTART IDENTITY CASCADE` ;
1968
- poolMock . query . mockImplementationOnce ( ( query , callback ) => {
1969
- callback ( null ) ; // Simulates successful query execution
1970
- } ) ;
1971
-
1972
- await expect ( errsolePostgres . DeleteAllLogs ( ) ) . resolves . not . toThrow ( ) ;
1973
-
1974
- expect ( poolMock . query ) . toHaveBeenCalledWith ( truncateQuery , expect . any ( Function ) ) ;
1975
- } ) ;
1976
-
1977
- it ( 'should handle errors during truncation of the logs table' , async ( ) => {
1978
- const truncateQuery = `TRUNCATE TABLE ${ errsolePostgres . logsTable } RESTART IDENTITY CASCADE` ;
1979
- const error = new Error ( 'Truncate query failed' ) ;
1980
- poolMock . query . mockImplementationOnce ( ( query , callback ) => {
1981
- callback ( error ) ; // Simulates query failure
1982
- } ) ;
1983
-
1984
- await expect ( errsolePostgres . DeleteAllLogs ( ) ) . rejects . toThrow ( 'Truncate query failed' ) ;
1985
-
1986
- expect ( poolMock . query ) . toHaveBeenCalledWith ( truncateQuery , expect . any ( Function ) ) ;
1987
- } ) ;
1988
- } ) ;
1989
-
1990
1965
afterAll ( ( ) => {
1991
1966
cronJob . stop ( ) ;
1992
1967
clearInterval ( errsolePostgres . flushIntervalId ) ;
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ declare module 'errsole-postgres' {
59
59
postLogs ( logEntries : Log [ ] ) : Promise < { } > ;
60
60
getLogs ( filters ?: LogFilter ) : Promise < { items : Log [ ] } > ;
61
61
searchLogs ( searchTerms : string [ ] , filters ?: LogFilter ) : Promise < { items : Log [ ] , filters : LogFilter [ ] } > ;
62
- DeleteAllLogs ( ) : Promise < void > ;
62
+ DeleteAllLogs ( ) : Promise < { } > ;
63
63
64
64
getMeta ( id : number ) : Promise < { item : { id : number ; meta : string } } > ;
65
65
You can’t perform that action at this time.
0 commit comments