Refactor(Test): Move Tests To Seperate Folder
This commit is contained in:
-24
@@ -10,27 +10,3 @@ pub mod prelude {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub use platforms::*;
|
pub use platforms::*;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::prelude::*;
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn connect_to_wifi_failed() {
|
|
||||||
let config = Some(Config {
|
|
||||||
interface: Some("wlo1"),
|
|
||||||
});
|
|
||||||
|
|
||||||
let mut wifi = WiFi::new(config);
|
|
||||||
|
|
||||||
assert_eq!(wifi.connect("ssid", "password").unwrap(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn create_hotspot() {
|
|
||||||
let hotspot_created = WiFi::create_hotspot("hello", "hi").unwrap();
|
|
||||||
|
|
||||||
assert_eq!(hotspot_created, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
extern crate wifi_rs;
|
||||||
|
use self::wifi_rs::{prelude::*, Config, WiFi};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn connect_to_wifi_failed() {
|
||||||
|
let config = Some(Config {
|
||||||
|
interface: Some("wlo1"),
|
||||||
|
});
|
||||||
|
|
||||||
|
let mut wifi = WiFi::new(config);
|
||||||
|
|
||||||
|
assert_eq!(wifi.connect("ssid", "password").unwrap(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn create_hotspot() {
|
||||||
|
let hotspot_created = WiFi::create_hotspot("hello", "hi").unwrap();
|
||||||
|
|
||||||
|
assert_eq!(hotspot_created, true);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user