Add source editing to ingest
All checks were successful
CI / build-and-deploy (push) Successful in 25s
All checks were successful
CI / build-and-deploy (push) Successful in 25s
This commit is contained in:
@@ -176,4 +176,26 @@ final class AppIntentsTests: XCTestCase {
|
||||
XCTAssertEqual(source.tags, ["offline"])
|
||||
XCTAssertNotNil(store.fileURL(for: source))
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testSourceLibraryUpdatesMetadataAndSearch() throws {
|
||||
let root = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true)
|
||||
defer { try? FileManager.default.removeItem(at: root) }
|
||||
|
||||
let library = IngestedSourceLibrary(store: IngestedSourceStore(rootURL: root))
|
||||
library.addText(title: "Draft", body: "Original extracted text", tags: ["raw"])
|
||||
|
||||
let source = try XCTUnwrap(library.sources.first)
|
||||
library.update(source, title: "Cleaned Notes", bodyText: "Cleaned source body", tags: ["clean", "notes"])
|
||||
|
||||
let updated = try XCTUnwrap(library.sources.first)
|
||||
XCTAssertEqual(updated.title, "Cleaned Notes")
|
||||
XCTAssertEqual(updated.bodyText, "Cleaned source body")
|
||||
XCTAssertEqual(updated.tags, ["clean", "notes"])
|
||||
XCTAssertGreaterThanOrEqual(updated.modifiedAt, source.modifiedAt)
|
||||
XCTAssertEqual(library.search("clean").first?.id, source.id)
|
||||
|
||||
let reloaded = IngestedSourceStore(rootURL: root)
|
||||
XCTAssertEqual(try reloaded.load().first?.title, "Cleaned Notes")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user