Add source editing to ingest
All checks were successful
CI / build-and-deploy (push) Successful in 25s

This commit is contained in:
Krishna Kumar
2026-07-02 16:35:02 -05:00
parent f7735431a8
commit 8e1d94a4ea
4 changed files with 119 additions and 1 deletions

View File

@@ -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")
}
}