Feat: Adds rated static pressure state tests.

This commit is contained in:
2024-06-17 16:10:10 -04:00
parent fd3d33878a
commit 2d94ded2eb

View File

@@ -0,0 +1,56 @@
import ComposableArchitecture
import PressureEstimationsFeature
import SharedModels
import Testing
struct RatedStaticPressureStateTests {
@Test(
"Rated static pressure validation",
.tags(.ratedStaticPressuresSection)
)
func validation() {
var state = RatedStaticPressuresSection.State(
staticPressures: Shared(RatedStaticPressures())
)
#expect(state.isValid)
state.maxPressure = nil
#expect(!state.isValid)
state.maxPressure = 1
state.minPressure = nil
#expect(!state.isValid)
state.minPressure = 1
state.ratedPressure = nil
#expect(!state.isValid)
state.ratedPressure = 1
#expect(state.isValid)
}
@Test(
"Focused field label",
.tags(.ratedStaticPressuresSection),
arguments: RatedStaticPressuresSection.State.FocusedField.allCases
)
func label(field: RatedStaticPressuresSection.State.FocusedField) {
#expect(field.label == "\(field.rawValue.capitalized)")
}
@Test(
"Focused field prompt",
.tags(.ratedStaticPressuresSection),
arguments: RatedStaticPressuresSection.State.FocusedField.allCases
)
func prompt(field: RatedStaticPressuresSection.State.FocusedField) {
#expect(field.prompt == "\(field.rawValue.capitalized) Pressure")
}
}
extension Tag {
@Tag static var ratedStaticPressuresSection: Self
}