commit ff12d8bd7ef978ff870f1f4bca980e762b7aac83
parent f8245a7b0ebb6bec2784866081f599a742d9949b
Author: Daniel D’Aquino <daniel@daquino.me>
Date: Fri, 25 Jul 2025 18:46:17 -0700
Prevent crash from ndb search test
Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/nostrdb/Test/NdbTests.swift b/nostrdb/Test/NdbTests.swift
@@ -81,7 +81,7 @@ final class NdbTests: XCTestCase {
}
- func test_ndb_seach() throws {
+ func test_ndb_search() throws {
do {
let ndb = Ndb(path: db_dir)!
let ok = ndb.process_events(test_wire_events)
@@ -93,6 +93,10 @@ final class NdbTests: XCTestCase {
let note_ids = ndb.text_search(query: "barked")
XCTAssertEqual(note_ids.count, 1)
let expected_note_id = NoteId(hex: "b17a540710fe8495b16bfbaf31c6962c4ba8387f3284a7973ad523988095417e")!
+ guard note_ids.count > 0 else {
+ XCTFail("Expected at least one note to be found")
+ return
+ }
let note_id = ndb.lookup_note_by_key(note_ids[0])?.map({ n in n?.id }).value
XCTAssertEqual(note_id, .some(expected_note_id))
}