Clean up test

This commit is contained in:
SkyfallWasTaken 2024-07-01 18:20:32 +01:00
parent 3d7a3a9d44
commit 01ea8485e8
3 changed files with 18 additions and 1 deletions

7
Cargo.lock generated
View file

@ -36,6 +36,7 @@ version = "0.1.0"
dependencies = [
"console_error_panic_hook",
"getrandom",
"indoc",
"scraper",
"serde",
"serde_json",
@ -355,6 +356,12 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "indoc"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
[[package]]
name = "itoa"
version = "1.0.11"

View file

@ -21,3 +21,6 @@ scraper = "0.19.0"
# We don't use getrandom, but we enable the "js" feature to enable
# WebAssembly support.
getrandom = { version = "0.2", features = ["js"] }
[dev-dependencies]
indoc = "2.0.5"

View file

@ -45,6 +45,7 @@ pub fn diff_items(old: ShopItem, new: ShopItem) -> Option<String> {
#[cfg(test)]
mod test {
use super::*;
use indoc::indoc;
#[test]
fn price_diff() {
@ -62,7 +63,13 @@ mod test {
assert_eq!(
diff_items(old, new),
Some("*Item updated*\n*Name:* Test\n*Price:* 1 → 2".into())
Some(
indoc! {"
*Item updated*
*Name:* Test
*Price:* 1 2"}
.into()
)
);
}
}