Skip to content

Commit 6414af0

Browse files
authored
Delete unused tests and mock functions
Removed tests and mock functions for database and server initialization.
1 parent f058730 commit 6414af0

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

src/main.rs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,3 @@ fn main() {
3131
}
3232
}
3333
}
34-
35-
#[cfg(test)]
36-
mod tests {
37-
use super::*;
38-
use std::net::TcpListener;
39-
40-
struct MockEnvVars {
41-
pub databse_url: String,
42-
pub server_adress_and_port: String,
43-
}
44-
45-
fn mock_get_environment_variables() -> MockEnvVars {
46-
MockEnvVars {
47-
databse_url: "postgres://localhost/test".to_string(),
48-
server_adress_and_port: "127.0.0.1:8080".to_string(),
49-
}
50-
}
51-
52-
fn mock_create_database_client(_url: String) -> Result<(), &'static str> {
53-
Ok(())
54-
}
55-
56-
fn mock_set_init_database_table(_client: Result<(), &'static str>) -> Result<(), &'static str> {
57-
Ok(())
58-
}
59-
60-
#[test]
61-
fn test_server_initialization_success() {
62-
let env = mock_get_environment_variables();
63-
let client = mock_create_database_client(env.databse_url.clone());
64-
let db_init_result = mock_set_init_database_table(client);
65-
66-
assert!(db_init_result.is_ok());
67-
}
68-
69-
70-
#[test]
71-
fn test_listener_binding() {
72-
let env = mock_get_environment_variables();
73-
let listener = TcpListener::bind(env.server_adress_and_port.clone());
74-
assert!(listener.is_ok(), "Listener should bind to address");
75-
}
76-
}

0 commit comments

Comments
 (0)