Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/test-dbs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: db-tests
on: [push, workflow_dispatch]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
package: [sembast_cache_manager, objectbox]
defaults:
run:
working-directory: ./packages/${{ matrix.package }}
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
architecture: x64 # optional, x64 or arm64
- run: flutter pub get
- name: Install ObjectBox C library (for objectbox package)
if: matrix.package == 'objectbox'
run: bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
- run: flutter test
4 changes: 2 additions & 2 deletions packages/amber/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,10 @@ packages:
dependency: transitive
description:
name: web
sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.1.1"
web_socket:
dependency: transitive
description:
Expand Down
39 changes: 12 additions & 27 deletions packages/ndk/test/relays/trailing_slash_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ void main() {
final broadcastResponses = await broadcast.broadcastDoneFuture;
expect(broadcastResponses.first.broadcastSuccessful, isTrue);

// Small delay to ensure relay has processed and stored the event
await Future.delayed(Duration(milliseconds: 100));

ndk.destroy();
});

Expand All @@ -49,9 +52,7 @@ void main() {
final ndk = Ndk.emptyBootstrapRelaysConfig();

final query = ndk.requests.query(
filters: [
Filter(kinds: [1], limit: 1),
],
filter: Filter(kinds: [1], limit: 1),
explicitRelays: [relay.url],
);

Expand All @@ -67,9 +68,7 @@ void main() {
final ndk = Ndk.emptyBootstrapRelaysConfig();

final query = ndk.requests.query(
filters: [
Filter(kinds: [1], limit: 1),
],
filter: Filter(kinds: [1], limit: 1),
explicitRelays: ["${relay.url}/"],
);

Expand All @@ -85,9 +84,7 @@ void main() {
final ndk = Ndk.emptyBootstrapRelaysConfig();

final query = ndk.requests.subscription(
filters: [
Filter(kinds: [1], limit: 1),
],
filter: Filter(kinds: [1], limit: 1),
explicitRelays: [relay.url],
);

Expand All @@ -103,9 +100,7 @@ void main() {
final ndk = Ndk.emptyBootstrapRelaysConfig();

final query = ndk.requests.subscription(
filters: [
Filter(kinds: [1], limit: 1),
],
filter: Filter(kinds: [1], limit: 1),
explicitRelays: ["${relay.url}/"],
);

Expand Down Expand Up @@ -185,9 +180,7 @@ void main() {
));

final query = ndk.requests.query(
filters: [
Filter(kinds: [1], limit: 1),
],
filter: Filter(kinds: [1], limit: 1),
explicitRelays: [relay.url],
);

Expand All @@ -207,9 +200,7 @@ void main() {
));

final query = ndk.requests.query(
filters: [
Filter(kinds: [1], limit: 1),
],
filter: Filter(kinds: [1], limit: 1),
explicitRelays: ["${relay.url}/"],
);

Expand All @@ -229,9 +220,7 @@ void main() {
));

final query = ndk.requests.subscription(
filters: [
Filter(kinds: [1], limit: 1),
],
filter: Filter(kinds: [1], limit: 1),
explicitRelays: [relay.url],
);

Expand All @@ -251,9 +240,7 @@ void main() {
));

final query = ndk.requests.subscription(
filters: [
Filter(kinds: [1], limit: 1),
],
filter: Filter(kinds: [1], limit: 1),
explicitRelays: ["${relay.url}/"],
);

Expand Down Expand Up @@ -340,9 +327,7 @@ void main() {
final ndk = Ndk.emptyBootstrapRelaysConfig();

final query = ndk.requests.query(
filters: [
Filter(kinds: [0]),
],
filter: Filter(kinds: [0]),
explicitRelays: ["wss:///example.com"],
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void _runEventTests(CacheManager Function() getCacheManager) {

final loadedEvents = await cacheManager.loadEvents(
tags: {
'#p': ['target_pubkey_ptag']
'p': ['target_pubkey_ptag']
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DbObjectBox implements CacheManager {
}

Future _init(bool attach, String? directory) async {
final objectbox;
final ObjectBoxInit objectbox;
if (attach) {
objectbox = await ObjectBoxInit.attach(directory: directory);
} else {
Expand Down Expand Up @@ -693,7 +693,8 @@ class DbObjectBox implements CacheManager {
List<FilterFetchedRangeRecord> records) async {
await dbRdy;
final box = _objectBox.store.box<DbFilterFetchedRangeRecord>();
box.putMany(records.map((r) => DbFilterFetchedRangeRecord.fromNdk(r)).toList());
box.putMany(
records.map((r) => DbFilterFetchedRangeRecord.fromNdk(r)).toList());
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DbNip01Event {
String content;

@Property()
String sig = '';
String? sig;

@Property()
bool? validSig;
Expand Down Expand Up @@ -151,7 +151,7 @@ class DbNip01Event {
dbTags: _listToTags(ndkE.tags).map((tag) => tag.toString()).toList(),
);
dbE.nostrId = ndkE.id;
dbE.sig = ndkE.sig!;
dbE.sig = ndkE.sig;
dbE.validSig = ndkE.validSig;
dbE.sources = ndkE.sources;
return dbE;
Expand Down Expand Up @@ -184,7 +184,8 @@ class DbTag {
@Property()
List<String> elements;

DbTag({this.key = '', this.value = '', this.marker, this.elements = const []});
DbTag(
{this.key = '', this.value = '', this.marker, this.elements = const []});

List<String> toList() {
// Return the full elements if available, otherwise construct from key/value/marker
Expand Down
6 changes: 4 additions & 2 deletions packages/objectbox/lib/objectbox.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading