File tree Expand file tree Collapse file tree 2 files changed +30
-8
lines changed
common/src/client/sync/stream Expand file tree Collapse file tree 2 files changed +30
-8
lines changed Original file line number Diff line number Diff line change @@ -964,14 +964,7 @@ The next upload iteration will be delayed.`);
964964 const syncOptions : SyncStreamOptions = {
965965 path : '/sync/stream' ,
966966 abortSignal : abortController . signal ,
967- data : {
968- ...instr . request ,
969- // FIXME the Rust core does not currently pass metadata through
970- app_metadata : {
971- ...resolvedOptions . appMetadata ,
972- ...instr . request . app_metadata
973- }
974- }
967+ data : instr . request
975968 } ;
976969
977970 if ( resolvedOptions . connectionMethod == SyncStreamConnectionMethod . HTTP ) {
Original file line number Diff line number Diff line change @@ -923,6 +923,35 @@ function defineSyncTests(impl: SyncClientImplementation) {
923923 expect . arrayContaining ( [ expect . stringContaining ( 'Cannot enqueue data into closed stream' ) ] )
924924 ) ;
925925 } ) ;
926+
927+ mockSyncServiceTest ( 'passes app metadata to the sync service' , async ( { syncService } ) => {
928+ const database = await syncService . createDatabase ( ) ;
929+ let connectCompleted = false ;
930+ database
931+ . connect ( new TestConnector ( ) , {
932+ ...options ,
933+ appMetadata : {
934+ name : 'test'
935+ }
936+ } )
937+ . then ( ( ) => {
938+ connectCompleted = true ;
939+ } ) ;
940+ expect ( connectCompleted ) . toBeFalsy ( ) ;
941+
942+ await vi . waitFor ( ( ) => expect ( syncService . connectedListeners ) . toHaveLength ( 1 ) ) ;
943+ // We want connected: true once we have a connection
944+
945+ await vi . waitFor ( ( ) => connectCompleted ) ;
946+ // The request should contain the app metadata
947+ expect ( syncService . connectedListeners [ 0 ] ) . toMatchObject (
948+ expect . objectContaining ( {
949+ app_metadata : {
950+ name : 'test'
951+ }
952+ } )
953+ ) ;
954+ } ) ;
926955}
927956
928957async function waitForProgress (
You can’t perform that action at this time.
0 commit comments