|
|
|
@ -35,36 +35,36 @@ class TargetSpec extends FlatSpec with Matchers { |
|
|
|
"Target" should "handle custom HR specification correctly" in { |
|
|
|
"Target" should "handle custom HR specification correctly" in { |
|
|
|
val hrcTarget = Target.parse("130-150 bpm").asInstanceOf[HrCustomTarget] |
|
|
|
val hrcTarget = Target.parse("130-150 bpm").asInstanceOf[HrCustomTarget] |
|
|
|
hrcTarget should be(HrCustomTarget(130, 150)) |
|
|
|
hrcTarget should be(HrCustomTarget(130, 150)) |
|
|
|
hrcTarget.json should be(Json.obj( |
|
|
|
hrcTarget.json should be( |
|
|
|
"targetType" -> Json.obj( |
|
|
|
Json.obj( |
|
|
|
"workoutTargetTypeId" -> 4, |
|
|
|
"targetType" -> Json.obj("workoutTargetTypeId" -> 4, "workoutTargetTypeKey" -> "heart.rate.zone"), |
|
|
|
"workoutTargetTypeKey" -> "heart.rate.zone"), |
|
|
|
|
|
|
|
"targetValueOne" -> 130, |
|
|
|
"targetValueOne" -> 130, |
|
|
|
"targetValueTwo" -> 150, |
|
|
|
"targetValueTwo" -> 150, |
|
|
|
"zoneNumber" -> JsNull)) |
|
|
|
"zoneNumber" -> JsNull |
|
|
|
|
|
|
|
)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
"Target" should "handle custom POWER specification correctly" in { |
|
|
|
"Target" should "handle custom POWER specification correctly" in { |
|
|
|
val powTarget = Target.parse("230-250 W").asInstanceOf[PowerCustomTarget] |
|
|
|
val powTarget = Target.parse("230-250 W").asInstanceOf[PowerCustomTarget] |
|
|
|
powTarget should be(PowerCustomTarget(230, 250)) |
|
|
|
powTarget should be(PowerCustomTarget(230, 250)) |
|
|
|
powTarget.json should be(Json.obj( |
|
|
|
powTarget.json should be( |
|
|
|
"targetType" -> Json.obj( |
|
|
|
Json.obj( |
|
|
|
"workoutTargetTypeId" -> 2, |
|
|
|
"targetType" -> Json.obj("workoutTargetTypeId" -> 2, "workoutTargetTypeKey" -> "power.zone"), |
|
|
|
"workoutTargetTypeKey" -> "power.zone"), |
|
|
|
|
|
|
|
"targetValueOne" -> 230, |
|
|
|
"targetValueOne" -> 230, |
|
|
|
"targetValueTwo" -> 250, |
|
|
|
"targetValueTwo" -> 250, |
|
|
|
"zoneNumber" -> JsNull)) |
|
|
|
"zoneNumber" -> JsNull |
|
|
|
|
|
|
|
)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
"Target" should "handle custom CADENCE specification correctly" in { |
|
|
|
"Target" should "handle custom CADENCE specification correctly" in { |
|
|
|
val cadenceTarget = Target.parse("80-90 rpm").asInstanceOf[CadenceCustomTarget] |
|
|
|
val cadenceTarget = Target.parse("80-90 rpm").asInstanceOf[CadenceCustomTarget] |
|
|
|
cadenceTarget should be(CadenceCustomTarget(80, 90)) |
|
|
|
cadenceTarget should be(CadenceCustomTarget(80, 90)) |
|
|
|
cadenceTarget.json should be(Json.obj( |
|
|
|
cadenceTarget.json should be( |
|
|
|
"targetType" -> Json.obj( |
|
|
|
Json.obj( |
|
|
|
"workoutTargetTypeId" -> 3, |
|
|
|
"targetType" -> Json.obj("workoutTargetTypeId" -> 3, "workoutTargetTypeKey" -> "cadence.zone"), |
|
|
|
"workoutTargetTypeKey" -> "cadence.zone"), |
|
|
|
|
|
|
|
"targetValueOne" -> 80, |
|
|
|
"targetValueOne" -> 80, |
|
|
|
"targetValueTwo" -> 90, |
|
|
|
"targetValueTwo" -> 90, |
|
|
|
"zoneNumber" -> JsNull)) |
|
|
|
"zoneNumber" -> JsNull |
|
|
|
|
|
|
|
)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|