diff --git a/Tests/PressureEstimationsFeatureTests/RatedStaticPressures.swift b/Tests/PressureEstimationsFeatureTests/RatedStaticPressures.swift new file mode 100644 index 0000000..cb07f42 --- /dev/null +++ b/Tests/PressureEstimationsFeatureTests/RatedStaticPressures.swift @@ -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 +}