@@ -105,6 +105,39 @@ void main() async {
105105 expect (list, isEmpty);
106106 });
107107
108+ test ('broadcast deletion 2' , () async {
109+ ndk.accounts
110+ .loginPrivateKey (pubkey: key0.publicKey, privkey: key0.privateKey! );
111+ Nip01Event event1 = Nip01Event (
112+ pubKey: key0.publicKey,
113+ kind: Nip01Event .kTextNodeKind,
114+ tags: [],
115+ content: "1" );
116+ Nip01Event event2 = Nip01Event (
117+ pubKey: key0.publicKey,
118+ kind: Nip01Event .kTextNodeKind,
119+ tags: [],
120+ content: "2" );
121+ NdkBroadcastResponse response1 =
122+ ndk.broadcast.broadcast (nostrEvent: event1);
123+ await response1.broadcastDoneFuture;
124+ NdkBroadcastResponse response2 =
125+ ndk.broadcast.broadcast (nostrEvent: event2);
126+ await response2.broadcastDoneFuture;
127+
128+ List <Nip01Event > list = await ndk.requests.query (filters: [
129+ Filter (authors: [event1.pubKey], kinds: [Nip01Event .kTextNodeKind])
130+ ]).future;
131+
132+ response1 = ndk.broadcast.broadcastDeletion (eventIds: [event1.id, event2.id]);
133+ await response1.broadcastDoneFuture;
134+
135+ list = await ndk.requests.query (filters: [
136+ Filter (authors: [event1.pubKey], kinds: [Nip01Event .kTextNodeKind])
137+ ]).future;
138+ expect (list, isEmpty);
139+ });
140+
108141 test ('broadcast reaction' , () async {
109142 ndk.accounts
110143 .loginPrivateKey (pubkey: key0.publicKey, privkey: key0.privateKey! );
@@ -133,6 +166,15 @@ void main() async {
133166 expect (list.first.content, reaction);
134167 });
135168
169+ test ('broadcast deletion with empty eventIds throws ArgumentError' , () async {
170+ ndk.accounts
171+ .loginPrivateKey (pubkey: key0.publicKey, privkey: key0.privateKey! );
172+ expect (
173+ () => ndk.broadcast.broadcastDeletion (eventIds: []),
174+ throwsA (isA <ArgumentError >()),
175+ );
176+ });
177+
136178 test ('broadcast respects timeout parameter' , () async {
137179 ndk.accounts
138180 .loginPrivateKey (pubkey: key0.publicKey, privkey: key0.privateKey! );
0 commit comments