From d077a320226e26a7cba928c619822c8509b7548b Mon Sep 17 00:00:00 2001 From: ymgyt Date: Sat, 1 Jun 2024 12:05:24 +0900 Subject: [PATCH] feat(term): match feed url --- Cargo.lock | 33 ++++++++++++++++ Cargo.toml | 1 + crates/synd_term/Cargo.toml | 3 +- crates/synd_term/src/types/mod.rs | 9 +++-- crates/synd_term/src/ui/components/filter.rs | 38 +++++++++++++++++-- .../src/ui/components/subscription.rs | 2 +- 6 files changed, 77 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f12e1c16..7e6852a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -824,6 +824,12 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "deunicode" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339544cc9e2c4dc3fc7149fd630c5f22263a4fdf18a98afd0075784968b5cf00" + [[package]] name = "difflib" version = "0.4.0" @@ -867,6 +873,18 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +[[package]] +name = "dummy" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e57e12b69e57fad516e01e2b3960f122696fdb13420e1a88ed8e210316f2876" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "dyn-clone" version = "1.0.17" @@ -952,6 +970,18 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "fake" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c25829bde82205da46e1823b2259db6273379f626fc211f126f65654a2669be" +dependencies = [ + "chrono", + "deunicode", + "dummy", + "rand", +] + [[package]] name = "fast_chemail" version = "0.9.6" @@ -3238,9 +3268,11 @@ dependencies = [ "async-graphql", "async-trait", "chrono", + "fake", "feed-rs", "futures-util", "moka", + "rand", "reqwest", "serde", "serde_json", @@ -3286,6 +3318,7 @@ dependencies = [ "crossterm", "directories", "edit", + "fake", "futures-util", "graphql_client", "html2text", diff --git a/Cargo.toml b/Cargo.toml index 2893bc2a..151430d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ axum-server = { version = "0.6.0", features = ["tls-rustls"] } bitflags = { version = "2.5.0", default-features = false } chrono = { version = "0.4.31", default-features = false } clap = { version = "4.5", default-features = false } +fake = { version = "2.9.2", features = ["derive", "chrono"] } fdlimit = { version = "0.3.0", default-features = false } feed-rs = { version = "1.4", default-features = false } futures-util = { version = "0.3.30", default-features = false } diff --git a/crates/synd_term/Cargo.toml b/crates/synd_term/Cargo.toml index 9f53d22b..736fc85b 100644 --- a/crates/synd_term/Cargo.toml +++ b/crates/synd_term/Cargo.toml @@ -19,7 +19,7 @@ path = "src/main.rs" [dependencies] synd-auth = { path = "../synd_auth", version = "0.2.2" } -synd-feed = { path = "../synd_feed", version = "0.3.2" } +synd-feed = { path = "../synd_feed", version = "0.3.2", features = ["fake"] } synd-o11y = { path = "../synd_o11y", version = "0.1.6" } anyhow = { workspace = true } @@ -65,6 +65,7 @@ synd-test = { path = "../synd_test" } assert_cmd = { workspace = true } axum-server = { workspace = true } +fake = { workspace = true } insta = { workspace = true } kvsd = { workspace = true } serial_test = { version = "3.0.0", default_features = false, features = ["async", "file_locks"] } diff --git a/crates/synd_term/src/types/mod.rs b/crates/synd_term/src/types/mod.rs index bcebef3c..f3f9afc9 100644 --- a/crates/synd_term/src/types/mod.rs +++ b/crates/synd_term/src/types/mod.rs @@ -21,6 +21,7 @@ mod requirement_ext; pub use requirement_ext::RequirementExt; #[derive(Debug, Clone)] +#[cfg_attr(test, derive(fake::Dummy))] pub struct Link { pub href: String, pub rel: Option, @@ -51,6 +52,7 @@ impl From for Link { } #[derive(Debug, Clone)] +#[cfg_attr(test, derive(fake::Dummy))] pub struct EntryMeta { pub title: Option, pub published: Option