Skip to content

Commit

Permalink
fix(1261): format code for linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Simonetti authored and Jarema committed Jul 30, 2024
1 parent a54ec80 commit 24e985a
Showing 1 changed file with 55 additions and 57 deletions.
112 changes: 55 additions & 57 deletions async-nats/tests/kv_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,72 +795,70 @@ mod kv {
keys.sort();
assert_eq!(vec!["bar", "foo"], keys);


let mut keys_with_filter = kv
.keys_with_filters(vec!["bar"])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();
keys_with_filter.sort();
assert_eq!(vec!["bar"], keys_with_filter);


kv.put("foo1.bar", 37.to_string().into()).await.unwrap();
kv.put("foo1.baz.boo", 73.to_string().into()).await.unwrap();
kv.put("foo1.baz.baz", 89.to_string().into()).await.unwrap();

let mut keys_with_filters = kv
.keys_with_filters(vec!["foo", "bar"])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();
keys_with_filters.sort();
assert_eq!(vec!["bar", "foo"], keys_with_filters);

let mut keys_with_filters = kv
.keys_with_filters(vec!["foo1.*.*"])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();
keys_with_filters.sort();
assert_eq!(vec!["foo1.baz.baz", "foo1.baz.boo"], keys_with_filters);
.keys_with_filters(vec!["bar"])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();
keys_with_filter.sort();
assert_eq!(vec!["bar"], keys_with_filter);

kv.put("foo1.bar", 37.to_string().into()).await.unwrap();
kv.put("foo1.baz.boo", 73.to_string().into()).await.unwrap();
kv.put("foo1.baz.baz", 89.to_string().into()).await.unwrap();

let mut keys_with_filters = kv
.keys_with_filters(vec!["foo1.*.*", "foo1.*"])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();
keys_with_filters.sort();
assert_eq!(vec!["foo1.bar", "foo1.baz.baz", "foo1.baz.boo"], keys_with_filters);
let mut keys_with_filters = kv
.keys_with_filters(vec!["foo", "bar"])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();
keys_with_filters.sort();
assert_eq!(vec!["bar", "foo"], keys_with_filters);

let mut keys_with_filters = kv
.keys_with_filters(vec!["*.baz.*",])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();
let mut keys_with_filters = kv
.keys_with_filters(vec!["foo1.*.*"])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();
keys_with_filters.sort();
assert_eq!(vec!["foo1.baz.baz", "foo1.baz.boo"], keys_with_filters);

keys_with_filters.sort();
assert_eq!(vec!["foo1.baz.baz", "foo1.baz.boo"], keys_with_filters);
let mut keys_with_filters = kv
.keys_with_filters(vec!["foo1.*.*", "foo1.*"])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();
keys_with_filters.sort();
assert_eq!(
vec!["foo1.bar", "foo1.baz.baz", "foo1.baz.boo"],
keys_with_filters
);

let mut keys_with_filters = kv
.keys_with_filters(vec!["*.baz.*"])
.await
.unwrap()
.try_collect::<Vec<String>>()
.await
.unwrap();

// cleanup the keys
kv.delete("foo1.bar").await.unwrap();
kv.delete("foo1.baz.boo").await.unwrap();
kv.delete("foo1.baz.baz").await.unwrap();
keys_with_filters.sort();
assert_eq!(vec!["foo1.baz.baz", "foo1.baz.boo"], keys_with_filters);

// filters like "foo.b*" should not return anything because it's not a valid filter
// cleanup the keys
kv.delete("foo1.bar").await.unwrap();
kv.delete("foo1.baz.boo").await.unwrap();
kv.delete("foo1.baz.baz").await.unwrap();

// filters like "foo.b*" should not return anything because it's not a valid filter

// Delete a key and make sure it doesn't show up in the keys list
kv.delete("bar").await.unwrap();
Expand Down

0 comments on commit 24e985a

Please sign in to comment.