From ce8e7e974cae2ff1ae16fe58589c33dc2f3b040a Mon Sep 17 00:00:00 2001 From: Tomasz Pietrek Date: Thu, 22 Aug 2024 14:10:50 +0200 Subject: [PATCH] Add PartialEq and Eq to Entry and improve entry tests --- async-nats/src/jetstream/kv/mod.rs | 2 +- async-nats/tests/kv_tests.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/async-nats/src/jetstream/kv/mod.rs b/async-nats/src/jetstream/kv/mod.rs index ca60b2692..9f48668e0 100644 --- a/async-nats/src/jetstream/kv/mod.rs +++ b/async-nats/src/jetstream/kv/mod.rs @@ -1226,7 +1226,7 @@ impl futures::Stream for Keys { } /// An entry in a key-value bucket. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Entry { /// Name of the bucket the entry is in. pub bucket: String, diff --git a/async-nats/tests/kv_tests.rs b/async-nats/tests/kv_tests.rs index 948839ed9..1901ca092 100644 --- a/async-nats/tests/kv_tests.rs +++ b/async-nats/tests/kv_tests.rs @@ -215,6 +215,9 @@ mod kv { let value = kv.entry_for_revision("key", 1).await.unwrap(); assert_eq!(from_utf8(&value.unwrap().value).unwrap(), "data"); + + let value = kv.entry_for_revision("key", 250).await.unwrap(); + assert!(value.is_none()); } #[tokio::test]