@@ -797,6 +797,57 @@ function defineSyncTests(impl: SyncClientImplementation) {
797797
798798 expect ( ( await query . next ( ) ) . value . rows . _array ) . toStrictEqual ( [ ] ) ;
799799 } ) ;
800+ } else {
801+ mockSyncServiceTest ( 'warns about raw tables' , async ( { syncService } ) => {
802+ const customSchema = new Schema ( { } ) ;
803+ customSchema . withRawTables ( {
804+ lists : {
805+ put : {
806+ sql : 'INSERT OR REPLACE INTO lists (id, name) VALUES (?, ?)' ,
807+ params : [ 'Id' , { Column : 'name' } ]
808+ } ,
809+ delete : {
810+ sql : 'DELETE FROM lists WHERE id = ?' ,
811+ params : [ 'Id' ]
812+ }
813+ }
814+ } ) ;
815+
816+ const logger = createLogger ( 'test' , { logLevel : Logger . TRACE } ) ;
817+ const logMessages : string [ ] = [ ] ;
818+ ( logger as any ) . invoke = ( level , args ) => {
819+ console . log ( ...args ) ;
820+ logMessages . push ( util . format ( ...args ) ) ;
821+ } ;
822+
823+ const powersync = await syncService . createDatabase ( { schema : customSchema , logger } ) ;
824+ powersync . connect ( new TestConnector ( ) , options ) ;
825+
826+ await vi . waitFor ( ( ) => expect ( syncService . connectedListeners ) . toHaveLength ( 1 ) ) ;
827+ expect ( logMessages ) . toEqual (
828+ expect . arrayContaining ( [ expect . stringContaining ( 'Raw tables require the Rust-based sync client' ) ] )
829+ ) ;
830+ } ) ;
831+
832+ mockSyncServiceTest ( `does not warn about raw tables if they're not used` , async ( { syncService } ) => {
833+ // Regression test for https://github.com/powersync-ja/powersync-js/issues/672
834+ const customSchema = new Schema ( { } ) ;
835+
836+ const logger = createLogger ( 'test' , { logLevel : Logger . TRACE } ) ;
837+ const logMessages : string [ ] = [ ] ;
838+ ( logger as any ) . invoke = ( level , args ) => {
839+ console . log ( ...args ) ;
840+ logMessages . push ( util . format ( ...args ) ) ;
841+ } ;
842+
843+ const powersync = await syncService . createDatabase ( { schema : customSchema , logger } ) ;
844+ powersync . connect ( new TestConnector ( ) , options ) ;
845+
846+ await vi . waitFor ( ( ) => expect ( syncService . connectedListeners ) . toHaveLength ( 1 ) ) ;
847+ expect ( logMessages ) . not . toEqual (
848+ expect . arrayContaining ( [ expect . stringContaining ( 'Raw tables require the Rust-based sync client' ) ] )
849+ ) ;
850+ } ) ;
800851 }
801852}
802853
0 commit comments