feat: Adds snapshot tests and updates Dockerfile.dev for docker tests.
This commit is contained in:
@@ -3,6 +3,7 @@ import Elementary
|
||||
import HTMLSnapshotTesting
|
||||
import Logging
|
||||
import OrderedCollections
|
||||
import PsychrometricClientLive
|
||||
import Routes
|
||||
import SnapshotTesting
|
||||
import Testing
|
||||
@@ -14,11 +15,13 @@ struct ViewControllerTests {
|
||||
let record = SnapshotTestingConfiguration.Record.missing
|
||||
let logger = Logger(label: "ViewControllerTests")
|
||||
|
||||
// swiftlint:disable function_body_length
|
||||
@Test
|
||||
func snapShotTests() async throws {
|
||||
try await withSnapshotTesting(record: record) {
|
||||
try await withDependencies {
|
||||
$0.viewController = .liveValue
|
||||
$0.psychrometricClient = .liveValue
|
||||
} operation: {
|
||||
@Dependency(\.viewController) var viewController
|
||||
|
||||
@@ -33,15 +36,18 @@ struct ViewControllerTests {
|
||||
atticDewpoint: 76,
|
||||
atticFloorArea: 1234
|
||||
))),
|
||||
|
||||
// Capacitor
|
||||
.capacitor(.index),
|
||||
.capacitor(.index(mode: .size)),
|
||||
.capacitor(.index(mode: .test)),
|
||||
.capacitor(.submit(.size(.init(runningAmps: 10.7, lineVoltage: 243, powerFactor: 0.86)))),
|
||||
.capacitor(.submit(.test(.init(startWindingAmps: 4.3, runToCommonVoltage: 343)))),
|
||||
|
||||
// Dehumidifier Sizing
|
||||
.dehumidifierSize(.index),
|
||||
.dehumidifierSize(.submit(.init(latentLoad: 3443, temperature: 76, humidity: 67))),
|
||||
|
||||
// Filter Pressure Drop
|
||||
.filterPressureDrop(.index),
|
||||
.filterPressureDrop(.index(mode: .basic)),
|
||||
@@ -60,7 +66,66 @@ struct ViewControllerTests {
|
||||
ratedAirflow: 800,
|
||||
ratedPressureDrop: 0.1,
|
||||
designAirflow: 900
|
||||
)))),
|
||||
|
||||
// Heating Balance Point
|
||||
.heatingBalancePoint(.index),
|
||||
.heatingBalancePoint(.heatLossFields(mode: .estimated)),
|
||||
.heatingBalancePoint(.heatLossFields(mode: .known)),
|
||||
.heatingBalancePoint(.submit(.economic(.init(
|
||||
fuelType: .propane,
|
||||
fuelCostPerUnit: 2.43,
|
||||
fuelAFUE: 90,
|
||||
costPerKW: 0.13
|
||||
)))),
|
||||
.heatingBalancePoint(.submit(.thermal(.init(
|
||||
systemSize: 2,
|
||||
capacityAt47: 24600,
|
||||
capacityAt17: 15100,
|
||||
heatingDesignTemperature: 5,
|
||||
buildingHeatLoss: .known(btu: 45667),
|
||||
climateZone: .five
|
||||
)))),
|
||||
|
||||
// HVAC System Performance
|
||||
.hvacSystemPerformance(.index),
|
||||
.hvacSystemPerformance(.submit(.init(
|
||||
altitude: 800,
|
||||
airflow: 800,
|
||||
returnAirTemperature: 76,
|
||||
returnAirHumidity: 67,
|
||||
supplyAirTemperature: 56,
|
||||
supplyAirHumidity: 89,
|
||||
systemSize: 2
|
||||
))),
|
||||
|
||||
// Mold risk
|
||||
.moldRisk(.index),
|
||||
.moldRisk(.submit(.init(temperature: 76, humidity: 67))),
|
||||
|
||||
// Psychrometrics
|
||||
.psychrometrics(.index),
|
||||
.psychrometrics(.submit(.init(temperature: 76, humidity: 67, altitude: 800))),
|
||||
|
||||
// Room pressures
|
||||
.roomPressure(.index),
|
||||
.roomPressure(.index(mode: .measuredPressure)),
|
||||
.roomPressure(.submit(.knownAirflow(.init(
|
||||
targetRoomPressure: 3,
|
||||
doorWidth: 30,
|
||||
doorHeight: 86,
|
||||
doorUndercut: 1,
|
||||
supplyAirflow: 200,
|
||||
preferredGrilleHeight: .fourteen
|
||||
)))),
|
||||
.roomPressure(.submit(.measuredPressure(.init(
|
||||
measuredRoomPressure: 4,
|
||||
doorWidth: 30,
|
||||
doorHeight: 86,
|
||||
doorUndercut: 1,
|
||||
preferredGrilleHeight: .fourteen
|
||||
))))
|
||||
|
||||
])
|
||||
|
||||
for route in arguments {
|
||||
@@ -71,6 +136,8 @@ struct ViewControllerTests {
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable function_body_length
|
||||
|
||||
}
|
||||
|
||||
private extension ViewController {
|
||||
|
||||
Reference in New Issue
Block a user