nostr fetch from relay test
This commit is contained in:
parent
cabac5ec49
commit
fca846eb43
1 changed files with 15 additions and 4 deletions
|
|
@ -26,7 +26,11 @@ void main() {
|
|||
group('relay.otherwhere.app fetch', () {
|
||||
test('fetches kind 0 (metadata) by author', () async {
|
||||
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;
|
||||
expect(events, isNotEmpty);
|
||||
|
|
@ -70,7 +74,10 @@ void main() {
|
|||
|
||||
test('fetched events have valid BIP-340 signatures', () async {
|
||||
final result = await fetcher.handle(FetchEvents(
|
||||
filter({'authors': [pubkey], 'limit': 10}),
|
||||
filter({
|
||||
'authors': [pubkey],
|
||||
'limit': 10
|
||||
}),
|
||||
));
|
||||
final events = (result as EventsFetched).events;
|
||||
expect(events, isNotEmpty);
|
||||
|
|
@ -89,9 +96,13 @@ void main() {
|
|||
}, timeout: const Timeout(Duration(seconds: 15)));
|
||||
|
||||
test('returns empty list for unknown author', () async {
|
||||
const unknown = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef';
|
||||
const unknown =
|
||||
'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef';
|
||||
final result = await fetcher.handle(FetchEvents(
|
||||
filter({'authors': [unknown], 'limit': 5}),
|
||||
filter({
|
||||
'authors': [unknown],
|
||||
'limit': 5
|
||||
}),
|
||||
));
|
||||
expect((result as EventsFetched).events, isEmpty);
|
||||
}, timeout: const Timeout(Duration(seconds: 15)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue