file unittests

pull/9/head
prplV 2024-10-30 15:29:23 +03:00
parent 0be23dfb43
commit 60eedef967
1 changed files with 17 additions and 13 deletions

View File

@ -118,22 +118,26 @@ pub async fn check_file(filename: &str, path: &str) -> Result<(), CustomError> {
#[cfg(test)]
mod files_unittest {
mod files_unittests {
use super::*;
#[test]
fn try_to_create_watcher() {
#[tokio::test]
async fn try_to_create_watcher() {
let res = create_watcher("dep-file", "/home/user/monitor/runner-rs/tests/examples/").await;
assert!(res.is_ok());
}
#[test]
fn try_to_create_invalid_watcher() {
#[tokio::test]
async fn try_to_create_invalid_watcher() {
let res = create_watcher("invalid-file", "/path/to/the/hell").await;
assert!(res.is_err());
}
#[test]
fn check_existing_file() {
#[tokio::test]
async fn check_existing_file() {
let res = check_file("dep-file", "/home/user/monitor/runner-rs/tests/examples/").await;
assert!(res.is_ok());
}
#[test]
fn check_non_existing_file() {
#[tokio::test]
async fn check_non_existing_file() {
let res = check_file("invalid-file", "/path/to/the/hell").await;
assert!(res.is_err());
}
}