Add serialisation test for Strategy

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2024-07-22 23:24:02 +10:00
parent 832a6c13ae
commit ac19952110
No known key found for this signature in database
GPG key ID: 76D1E687CA3C4928
3 changed files with 21 additions and 0 deletions

1
Cargo.lock generated
View file

@ -425,6 +425,7 @@ dependencies = [
"once_cell", "once_cell",
"semver", "semver",
"serde", "serde",
"serde_json",
"strum", "strum",
"strum_macros", "strum_macros",
"url", "url",

View file

@ -18,3 +18,6 @@ serde = { version = "1.0.163", features = ["derive"] }
strum = "0.26.1" strum = "0.26.1"
strum_macros = "0.26.1" strum_macros = "0.26.1"
url = { version = "2.3.1", features = ["serde"] } url = { version = "2.3.1", features = ["serde"] }
[dev-dependencies]
serde_json = "1"

View file

@ -177,3 +177,20 @@ pub enum SigningAlgorithm {
/// [minisign](https://jedisct1.github.io/minisign/) /// [minisign](https://jedisct1.github.io/minisign/)
Minisign, Minisign,
} }
#[cfg(test)]
mod tests {
use strum::VariantArray;
use super::*;
#[test]
fn test_strategy_ser() {
Strategy::VARIANTS.iter().for_each(|strategy| {
assert_eq!(
serde_json::to_string(&strategy).unwrap(),
format!(r#""{}""#, strategy.to_str())
)
});
}
}