File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -394,4 +394,20 @@ mod tests {
394394 item1. delete ( None ) . await . unwrap ( ) ;
395395 item2. delete ( None ) . await . unwrap ( ) ;
396396 }
397+
398+ #[ tokio:: test]
399+ async fn label_mutation ( ) {
400+ let service = Service :: plain ( ) . await . unwrap ( ) ;
401+ let collection = service. session_collection ( ) . await . unwrap ( ) ;
402+
403+ let initial_label = collection. label ( ) . await . unwrap ( ) ;
404+
405+ collection. set_label ( "Updated Label" ) . await . unwrap ( ) ;
406+ assert_eq ! ( collection. label( ) . await . unwrap( ) , "Updated Label" ) ;
407+ assert_ne ! ( collection. label( ) . await . unwrap( ) , initial_label) ;
408+
409+ // Restore original label
410+ collection. set_label ( & initial_label) . await . unwrap ( ) ;
411+ assert_eq ! ( collection. label( ) . await . unwrap( ) , initial_label) ;
412+ }
397413}
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ impl<'a> Service<'a> {
121121 /// translate the string, use [Self::with_alias_or_create] instead.
122122 pub async fn session_collection ( & self ) -> Result < Collection < ' a > , Error > {
123123 // TODO: Figure how to make those labels translatable
124- self . with_alias_or_create ( Self :: SESSION_COLLECTION , "Session" , None )
124+ self . with_alias_or_create ( "default" , "Session" , None )
125125 . await
126126 }
127127
@@ -260,4 +260,20 @@ mod tests {
260260 assert ! ( service. default_collection( ) . await . is_ok( ) ) ;
261261 assert ! ( service. session_collection( ) . await . is_ok( ) ) ;
262262 }
263+
264+ #[ tokio:: test]
265+ async fn encrypted_session ( ) {
266+ let service = Service :: encrypted ( ) . await . unwrap ( ) ;
267+ assert ! ( service. default_collection( ) . await . is_ok( ) ) ;
268+
269+ service. session . close ( ) . await . unwrap ( ) ;
270+ }
271+
272+ #[ tokio:: test]
273+ async fn plain_session ( ) {
274+ let service = Service :: plain ( ) . await . unwrap ( ) ;
275+ assert ! ( service. default_collection( ) . await . is_ok( ) ) ;
276+
277+ service. session . close ( ) . await . unwrap ( ) ;
278+ }
263279}
You can’t perform that action at this time.
0 commit comments