ndb: add initial search interface
Still needs updating because of the tuple array
This commit is contained in:
@@ -81,6 +81,23 @@ final class NdbTests: XCTestCase {
|
||||
|
||||
}
|
||||
|
||||
func test_ndb_seach() throws {
|
||||
do {
|
||||
let ndb = try! Ndb(path: db_dir)!
|
||||
let ok = ndb.process_events(test_wire_events)
|
||||
XCTAssertTrue(ok)
|
||||
}
|
||||
|
||||
do {
|
||||
let ndb = try! Ndb(path: db_dir)!
|
||||
let note_ids = ndb.text_search(query: "barked")
|
||||
XCTAssertEqual(note_ids.count, 1)
|
||||
let expected_note_id = NoteId(hex: "b17a540710fe8495b16bfbaf31c6962c4ba8387f3284a7973ad523988095417e")!
|
||||
let note_id = ndb.lookup_note_by_key(note_ids[0]).map({ n in n?.id }).value
|
||||
XCTAssertEqual(note_id, .some(expected_note_id))
|
||||
}
|
||||
}
|
||||
|
||||
func test_ndb_note() throws {
|
||||
let note = NdbNote.owned_from_json(json: test_contact_list_json)
|
||||
XCTAssertNotNil(note)
|
||||
|
||||
Reference in New Issue
Block a user