Skip to content

Commit

Permalink
Fix flag state required in mission action data input
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Jun 10, 2024
1 parent 07b7018 commit 5d4ace9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class AddMissionActionDataInput(
var internalReferenceNumber: String? = null,
var externalReferenceNumber: String? = null,
var ircs: String? = null,
var flagState: CountryCode,
var flagState: CountryCode? = CountryCode.UNDEFINED,
var districtCode: String? = null,
var faoAreas: List<String> = listOf(),
var flightGoals: List<FlightGoal> = listOf(),
Expand Down Expand Up @@ -63,7 +63,7 @@ data class AddMissionActionDataInput(
internalReferenceNumber = internalReferenceNumber,
externalReferenceNumber = externalReferenceNumber,
ircs = ircs,
flagState = flagState,
flagState = flagState ?: CountryCode.UNDEFINED,
districtCode = districtCode,
faoAreas = faoAreas,
flightGoals = flightGoals,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,12 @@ class MissionActionsControllerITests {
}

@Test
fun `Should not update a mission action with a missing flagState`() {
fun `Should update a mission action with a missing flagState`() {
// Given
val dateTime = ZonedDateTime.parse("2022-05-05T03:04:05.000Z")
val newMission = TestUtils.getDummyMissionAction(dateTime).copy(flagState = CountryCode.UNDEFINED)
given(updateMissionAction.execute(any(), any())).willReturn(newMission)

// When
api.perform(
put("/bff/v1/mission_actions/123")
Expand All @@ -314,17 +319,19 @@ class MissionActionsControllerITests {
"flagState": null,
"districtCode": "AD",
"faoAreas": [],
"userTrigram": "LTH",
"completion": "COMPLETED",
"flightGoals": [],
"missionId": 10556,
"actionType": "LAND_CONTROL",
"actionDatetimeUtc": "2024-02-01T14:29:00Z",
"actionType": "OBSERVATION",
"actionDatetimeUtc": "2024-02-01T14:29:00Z"
}
""".trimIndent(),
)
.contentType(MediaType.APPLICATION_JSON),
)
// Then
.andExpect(status().isBadRequest)
.andExpect(status().isCreated)
}

@Test
Expand Down

0 comments on commit 5d4ace9

Please sign in to comment.