@@ -37,6 +37,33 @@ public function test_signs_the_window_in_so_it_can_reach_the_menu_endpoints(): v
3737 $ this ->assertAuthenticatedAs ($ session , 'editor ' );
3838 }
3939
40+ public function test_opens_a_session_that_needed_no_confirmation (): void
41+ {
42+ // The plugin marks these confirmed on creation but attaches no window.
43+ $ session = EditorSession::factory ()->create (['require_confirmation ' => false , 'confirmed ' => true ]);
44+ $ verificationId = (string ) Str::uuid ();
45+ $ session ->verifications ()->create (['verification_id ' => $ verificationId ]);
46+
47+ $ this ->getJson ($ this ->url ($ session ->session_id , $ verificationId ))
48+ ->assertOk ()
49+ ->assertJson (['valid ' => true , 'message ' => 'Session validated ' ]);
50+ }
51+
52+ public function test_refuses_a_second_window_on_a_session_that_needed_no_confirmation (): void
53+ {
54+ $ session = EditorSession::factory ()->create (['require_confirmation ' => false , 'confirmed ' => true ]);
55+ $ first = (string ) Str::uuid ();
56+ $ second = (string ) Str::uuid ();
57+ $ session ->verifications ()->create (['verification_id ' => $ first ]);
58+ $ session ->verifications ()->create (['verification_id ' => $ second ]);
59+
60+ $ this ->getJson ($ this ->url ($ session ->session_id , $ first ))->assertJson (['valid ' => true ]);
61+
62+ $ this ->getJson ($ this ->url ($ session ->session_id , $ second ))
63+ ->assertOk ()
64+ ->assertJson (['valid ' => false , 'message ' => 'Session already validated from another window ' ]);
65+ }
66+
4067 public function test_reserves_the_session_so_a_second_window_is_refused (): void
4168 {
4269 $ verificationId = (string ) Str::uuid ();
0 commit comments