nostr fetch from relay test

This commit is contained in:
randogoth 2026-06-07 16:51:48 +03:00
parent cabac5ec49
commit fca846eb43

View file

@ -26,7 +26,11 @@ void main() {
group('relay.otherwhere.app fetch', () { group('relay.otherwhere.app fetch', () {
test('fetches kind 0 (metadata) by author', () async { test('fetches kind 0 (metadata) by author', () async {
final result = await fetcher.handle(FetchEvents( final result = await fetcher.handle(FetchEvents(
filter({'kinds': [0], 'authors': [pubkey], 'limit': 1}), filter({
'kinds': [0],
'authors': [pubkey],
'limit': 1
}),
)); ));
final events = (result as EventsFetched).events; final events = (result as EventsFetched).events;
expect(events, isNotEmpty); expect(events, isNotEmpty);
@ -70,7 +74,10 @@ void main() {
test('fetched events have valid BIP-340 signatures', () async { test('fetched events have valid BIP-340 signatures', () async {
final result = await fetcher.handle(FetchEvents( final result = await fetcher.handle(FetchEvents(
filter({'authors': [pubkey], 'limit': 10}), filter({
'authors': [pubkey],
'limit': 10
}),
)); ));
final events = (result as EventsFetched).events; final events = (result as EventsFetched).events;
expect(events, isNotEmpty); expect(events, isNotEmpty);
@ -89,9 +96,13 @@ void main() {
}, timeout: const Timeout(Duration(seconds: 15))); }, timeout: const Timeout(Duration(seconds: 15)));
test('returns empty list for unknown author', () async { test('returns empty list for unknown author', () async {
const unknown = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef'; const unknown =
'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef';
final result = await fetcher.handle(FetchEvents( final result = await fetcher.handle(FetchEvents(
filter({'authors': [unknown], 'limit': 5}), filter({
'authors': [unknown],
'limit': 5
}),
)); ));
expect((result as EventsFetched).events, isEmpty); expect((result as EventsFetched).events, isEmpty);
}, timeout: const Timeout(Duration(seconds: 15))); }, timeout: const Timeout(Duration(seconds: 15)));