@@ -3,6 +3,7 @@ import { POSTGRES_REPORT_STORAGE_FACTORY } from './util.js';
33import { event_types } from '@powersync/service-types' ;
44import { register , ReportUserData } from '@powersync/service-core-tests' ;
55import { PostgresReportStorageFactory } from '../../src/storage/PostgresReportStorageFactory.js' ;
6+ import { DateTimeValue } from '@powersync/service-sync-rules' ;
67
78const factory = await POSTGRES_REPORT_STORAGE_FACTORY ( ) ;
89const userData = register . REPORT_TEST_USERS ;
@@ -151,8 +152,12 @@ describe('Connection report storage', async () => {
151152 const sdk = await factory . db
152153 . sql `SELECT * FROM connection_report_events WHERE user_id = ${ { type : 'varchar' , value : userData . user_one . user_id } } AND client_id = ${ { type : 'varchar' , value : userData . user_one . client_id } } ` . rows < event_types . ClientConnection > ( ) ;
153154 expect ( sdk ) . toHaveLength ( 1 ) ;
154- expect ( new Date ( sdk [ 0 ] . connected_at ) . toISOString ( ) ) . toEqual ( newConnectAt . toISOString ( ) ) ;
155- expect ( new Date ( sdk [ 0 ] . jwt_exp ! ) . toISOString ( ) ) . toEqual ( jwtExp . toISOString ( ) ) ;
155+ expect ( new Date ( ( sdk [ 0 ] . connected_at as unknown as DateTimeValue ) . iso8601Representation ) . toISOString ( ) ) . toEqual (
156+ newConnectAt . toISOString ( )
157+ ) ;
158+ expect ( new Date ( ( sdk [ 0 ] . jwt_exp ! as unknown as DateTimeValue ) . iso8601Representation ) . toISOString ( ) ) . toEqual (
159+ jwtExp . toISOString ( )
160+ ) ;
156161 expect ( sdk [ 0 ] . disconnected_at ) . toBeNull ( ) ;
157162 const cleaned = removeVolatileFields ( sdk ) ;
158163 expect ( cleaned ) . toMatchSnapshot ( ) ;
@@ -180,7 +185,10 @@ describe('Connection report storage', async () => {
180185 const sdk = await factory . db
181186 . sql `SELECT * FROM connection_report_events WHERE user_id = ${ { type : 'varchar' , value : userData . user_three . user_id } } ` . rows < event_types . ClientConnection > ( ) ;
182187 expect ( sdk ) . toHaveLength ( 1 ) ;
183- expect ( new Date ( sdk [ 0 ] . disconnected_at ! ) . toISOString ( ) ) . toEqual ( disconnectAt . toISOString ( ) ) ;
188+ console . log ( sdk [ 0 ] ) ;
189+ expect ( new Date ( ( sdk [ 0 ] . disconnected_at ! as unknown as DateTimeValue ) . iso8601Representation ) . toISOString ( ) ) . toEqual (
190+ disconnectAt . toISOString ( )
191+ ) ;
184192 const cleaned = removeVolatileFields ( sdk ) ;
185193 expect ( cleaned ) . toMatchSnapshot ( ) ;
186194 } ) ;
0 commit comments