File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
rust-executor/src/perspectives Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -281,7 +281,12 @@ impl PerspectiveInstance {
281281 let mut link_language_guard = self . link_language . lock ( ) . await ;
282282 if let Some ( link_language) = link_language_guard. as_mut ( ) {
283283 match link_language. sync ( ) . await {
284- Ok ( _) => ( ) ,
284+ Ok ( _) => {
285+ // Transition to Synced state on successful sync
286+ let _ = self
287+ . update_perspective_state ( PerspectiveState :: Synced )
288+ . await ;
289+ }
285290 Err ( e) => {
286291 log:: error!( "Error calling sync on link language: {:?}" , e) ;
287292 let _ = self
Original file line number Diff line number Diff line change @@ -42,7 +42,20 @@ export default function neighbourhoodTests(testContext: TestContext) {
4242 expect ( perspective ?. neighbourhood ) . not . to . be . undefined ;
4343 expect ( perspective ?. neighbourhood ! . data . linkLanguage ) . to . be . equal ( socialContext . address ) ;
4444 expect ( perspective ?. neighbourhood ! . data . meta . links . length ) . to . be . equal ( 1 ) ;
45- expect ( perspective ?. state ) . to . be . equal ( PerspectiveState . Synced ) ;
45+
46+ // The perspective should start in NeighbourhoodCreationInitiated state
47+ expect ( perspective ?. state ) . to . be . equal ( PerspectiveState . NeighboudhoodCreationInitiated ) ;
48+
49+ // Wait for the perspective to transition to Synced state
50+ let tries = 0 ;
51+ const maxTries = 10 ;
52+ let currentPerspective = perspective ;
53+ while ( currentPerspective ?. state !== PerspectiveState . Synced && tries < maxTries ) {
54+ await sleep ( 1000 ) ;
55+ currentPerspective = await ad4mClient . perspective . byUUID ( create . uuid ) ;
56+ tries ++ ;
57+ }
58+ expect ( currentPerspective ?. state ) . to . be . equal ( PerspectiveState . Synced ) ;
4659 } )
4760
4861 it ( 'can be created by Alice and joined by Bob' , async ( ) => {
You can’t perform that action at this time.
0 commit comments