Add test for admin deleted events
This commit is contained in:
parent
025ba52a81
commit
a178cdee05
|
@ -856,19 +856,23 @@ mod tests {
|
|||
|
||||
let admin_keys = nostr::Keys::from_sk_str(admin_secret).unwrap();
|
||||
|
||||
let event = nostr::EventBuilder::new(nostr::Kind::TextNote, "this is a test", vec![])
|
||||
let event_1 = nostr::EventBuilder::new(nostr::Kind::TextNote, "this is event 1", vec![])
|
||||
.to_event(&nostr::Keys::generate())
|
||||
.unwrap();
|
||||
let event_2 = nostr::EventBuilder::new(nostr::Kind::TextNote, "this is event 2", vec![])
|
||||
.to_event(&nostr::Keys::generate())
|
||||
.unwrap();
|
||||
|
||||
let res = db.add_event(Box::new(event.clone())).await.unwrap();
|
||||
let res = db.add_event(Box::new(event_1.clone())).await.unwrap();
|
||||
let res = db.add_event(Box::new(event_2.clone())).await.unwrap();
|
||||
|
||||
let e_ids = vec![event.id];
|
||||
let e_ids = vec![event_1.id, event_2.id];
|
||||
let event = nostr::EventBuilder::delete(e_ids)
|
||||
.to_event(&admin_keys)
|
||||
.unwrap();
|
||||
|
||||
let message = db.admin_delete_events(Box::new(event)).await.unwrap();
|
||||
assert_eq!(message.as_json(), "[\"NOTICE\",\"1 events deleted\"]");
|
||||
assert_eq!(message.as_json(), "[\"NOTICE\",\"2 events deleted\"]");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
Loading…
Reference in a new issue