Skip to content

Commit

Permalink
ci: add simple test
Browse files Browse the repository at this point in the history
Signed-off-by: martabal <74269598+martabal@users.noreply.github.com>
  • Loading branch information
martabal committed Jun 13, 2023
1 parent b78fa62 commit 211502d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 29 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Test
- name: Run tests
run: cargo test
- name: Run formatter
run: cargo fmt -- --check
52 changes: 26 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ base64 = "0.21.2"
dotenv = "0.15.0"
lazy_static = "1.4.0"
reqwest = { version = "0.11.18", features = ["json"] }
serde = { version = "1.0.163", features = ["derive"] }
serde_derive = "1.0.163"
serde = { version = "1.0.164", features = ["derive"] }
serde_derive = "1.0.164"
serde_json = "1.0.96"
serde_yaml = "0.9.21"
tokio = { version = "1.28.2", features = ["full"] }
14 changes: 14 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,17 @@ fn maskpassword(t: &str) -> String {
}
mask
}

#[cfg(test)]
mod tests {

use super::*;

#[tokio::test]
async fn test_maskpassword() {
let password = "secretpassword";
let result = maskpassword(password);
let supposed = "*".repeat(password.len());
assert_eq!(supposed, result);
}
}

0 comments on commit 211502d

Please # to comment.