feat: Adds createFromCSV to create rooms in the database, properly handling delegating airflow to another room.
Some checks failed
CI / Linux Tests (push) Failing after 5m29s

This commit is contained in:
2026-02-07 18:16:01 -05:00
parent 0134c9bfc2
commit 76bd788769
12 changed files with 171 additions and 2844 deletions

View File

@@ -1,4 +1,6 @@
import CSVParser
import Dependencies
import FileClient
import Foundation
import ManualDCore
import Parsing
@@ -63,6 +65,31 @@ struct RoomTests {
}
}
@Test
func createFromCSV() async throws {
try await withTestUserAndProject {
$0.csvParser = .liveValue
} operation: { _, project in
@Dependency(\.csvParser) var csvParser
@Dependency(\.database) var database
@Dependency(\.fileClient) var fileClient
let csvPath = Bundle.module.path(forResource: "rooms", ofType: "csv")
let csvFile = Room.CSV(file: try Data(contentsOf: URL(filePath: csvPath!)))
let rows = try await csvParser.parseRooms(csvFile)
print()
print("ROWS: \(rows)")
print()
let created = try await database.rooms.createFromCSV(project.id, rows)
print()
print("CREATED: \(created)")
print()
#expect(created.count == rows.count)
}
}
@Test
func notFound() async throws {
try await withDatabase {
@@ -157,4 +184,3 @@ struct RoomTests {
}
}
}