@@ -2,42 +2,52 @@ use napi_derive::napi;
22
33#[ napi( object) ]
44pub struct GetConnectionStringOptions {
5- pub container_id_or_name : String ,
6- pub db_username : Option < String > ,
7- pub db_password : Option < String > ,
8- pub verify : Option < bool > ,
5+ pub container_id_or_name : String ,
6+ pub db_username : Option < String > ,
7+ pub db_password : Option < String > ,
8+ pub verify : Option < bool > ,
99}
1010
1111impl From < GetConnectionStringOptions > for atlas_local:: models:: GetConnectionStringOptions {
12- fn from ( source : GetConnectionStringOptions ) -> Self {
13- Self {
14- container_id_or_name : source. container_id_or_name ,
15- db_username : source. db_username ,
16- db_password : source. db_password ,
17- verify : source. verify ,
18- }
12+ fn from ( source : GetConnectionStringOptions ) -> Self {
13+ Self {
14+ container_id_or_name : source. container_id_or_name ,
15+ db_username : source. db_username ,
16+ db_password : source. db_password ,
17+ verify : source. verify ,
1918 }
19+ }
2020}
2121
2222// test
2323#[ cfg( test) ]
2424mod tests {
25- use super :: * ;
25+ use super :: * ;
2626
27- #[ test]
28- fn test_get_connection_string_options ( ) {
29- let options = GetConnectionStringOptions {
30- container_id_or_name : "test_container" . into ( ) ,
31- db_username : Some ( "test_user" . into ( ) ) ,
32- db_password : Some ( "test_pass" . into ( ) ) ,
33- verify : Some ( true ) ,
34- } ;
27+ #[ test]
28+ fn test_get_connection_string_options ( ) {
29+ let options = GetConnectionStringOptions {
30+ container_id_or_name : "test_container" . into ( ) ,
31+ db_username : Some ( "test_user" . into ( ) ) ,
32+ db_password : Some ( "test_pass" . into ( ) ) ,
33+ verify : Some ( true ) ,
34+ } ;
3535
36- let get_connection_string_options: atlas_local:: models:: GetConnectionStringOptions = options. into ( ) ;
36+ let get_connection_string_options: atlas_local:: models:: GetConnectionStringOptions =
37+ options. into ( ) ;
3738
38- assert_eq ! ( get_connection_string_options. container_id_or_name, "test_container" ) ;
39- assert_eq ! ( get_connection_string_options. db_username, Some ( "test_user" . into( ) ) ) ;
40- assert_eq ! ( get_connection_string_options. db_password, Some ( "test_pass" . into( ) ) ) ;
41- assert_eq ! ( get_connection_string_options. verify, Some ( true ) ) ;
42- }
39+ assert_eq ! (
40+ get_connection_string_options. container_id_or_name,
41+ "test_container"
42+ ) ;
43+ assert_eq ! (
44+ get_connection_string_options. db_username,
45+ Some ( "test_user" . into( ) )
46+ ) ;
47+ assert_eq ! (
48+ get_connection_string_options. db_password,
49+ Some ( "test_pass" . into( ) )
50+ ) ;
51+ assert_eq ! ( get_connection_string_options. verify, Some ( true ) ) ;
52+ }
4353}
0 commit comments