@@ -201,8 +201,8 @@ describe("Logs", function () {
201201 it ( "Should throw error when start date is greater than end date in dev mode" , async function ( ) {
202202 await cleanDb ( ) ;
203203
204- const startDate = Date . now ( ) ;
205- const endDate = startDate - 86400000 ;
204+ const startDate = Math . floor ( Date . now ( ) / 1000 ) ;
205+ const endDate = startDate - 86400 ;
206206
207207 try {
208208 await logsQuery . fetchAllLogs ( {
@@ -222,9 +222,8 @@ describe("Logs", function () {
222222 it ( "Should return logs within the specified date range in dev mode" , async function ( ) {
223223 await cleanDb ( ) ;
224224
225- const endDate = Date . now ( ) ;
226- const startDate = endDate - 86400000 * 7 ;
227-
225+ const endDate = Math . floor ( Date . now ( ) / 1000 ) ;
226+ const startDate = endDate - 86400 * 7 ;
228227 const result = await logsQuery . fetchAllLogs ( {
229228 dev : "true" ,
230229 startDate : startDate . toString ( ) ,
@@ -235,14 +234,16 @@ describe("Logs", function () {
235234 expect ( result ) . to . have . property ( "allLogs" ) ;
236235 if ( result . allLogs . length > 0 ) {
237236 result . allLogs . forEach ( ( log ) => {
238- expect ( log ) . to . have . property ( "timestamp" ) ;
237+ expect ( log ) . to . have . property ( "timestamp" ) . that . is . a ( "number" ) ;
238+ expect ( log . timestamp ) . to . be . at . least ( startDate ) ;
239+ expect ( log . timestamp ) . to . be . at . most ( endDate ) ;
239240 } ) ;
240241 }
241242 } ) ;
242243
243244 it ( "Should ignore date filters when not in dev mode" , async function ( ) {
244- const endDate = Date . now ( ) ;
245- const startDate = endDate - 86400000 * 7 ;
245+ const endDate = Math . floor ( Date . now ( ) / 1000 ) ;
246+ const startDate = endDate - 86400 * 7 ;
246247
247248 const result = await logsQuery . fetchAllLogs ( {
248249 dev : "false" ,
@@ -258,7 +259,7 @@ describe("Logs", function () {
258259 } ) ;
259260
260261 it ( "Should handle only start date filter in dev mode" , async function ( ) {
261- const startDate = Date . now ( ) - 86400000 * 14 ;
262+ const startDate = Math . floor ( Date . now ( ) / 1000 ) - 86400 * 14 ;
262263
263264 const result = await logsQuery . fetchAllLogs ( {
264265 dev : "true" ,
@@ -269,10 +270,17 @@ describe("Logs", function () {
269270 expect ( result ) . to . have . property ( "allLogs" ) ;
270271 expect ( result ) . to . have . property ( "prev" ) ;
271272 expect ( result ) . to . have . property ( "next" ) ;
273+
274+ if ( result . allLogs . length > 0 ) {
275+ result . allLogs . forEach ( ( log ) => {
276+ expect ( log ) . to . have . property ( "timestamp" ) . that . is . a ( "number" ) ;
277+ expect ( log . timestamp ) . to . be . at . least ( startDate ) ;
278+ } ) ;
279+ }
272280 } ) ;
273281
274282 it ( "Should handle only end date filter in dev mode" , async function ( ) {
275- const endDate = Date . now ( ) ;
283+ const endDate = Math . floor ( Date . now ( ) / 1000 ) ;
276284
277285 const result = await logsQuery . fetchAllLogs ( {
278286 dev : "true" ,
@@ -283,6 +291,13 @@ describe("Logs", function () {
283291 expect ( result ) . to . have . property ( "allLogs" ) ;
284292 expect ( result ) . to . have . property ( "prev" ) ;
285293 expect ( result ) . to . have . property ( "next" ) ;
294+
295+ if ( result . allLogs . length > 0 ) {
296+ result . allLogs . forEach ( ( log ) => {
297+ expect ( log ) . to . have . property ( "timestamp" ) . that . is . a ( "number" ) ;
298+ expect ( log . timestamp ) . to . be . at . most ( endDate ) ;
299+ } ) ;
300+ }
286301 } ) ;
287302
288303 it ( "Should return null if no logs are presnet the logs for specific types" , async function ( ) {
0 commit comments