Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed May 29, 2024
1 parent b43a230 commit 58857df
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,42 @@ class JointDeploymentPlanUTests {
}
}

@ParameterizedTest
@EnumSource(JointDeploymentPlan::class)
fun `getFirstFaoAreaIncludedInJdp Should return the fao area for a LAND control`(
jdp: JointDeploymentPlan,
) {
// Given
val control = MissionAction(
id = 3,
vesselId = 2,
missionId = 3,
actionDatetimeUtc = ZonedDateTime.now(),
actionType = MissionActionType.LAND_CONTROL,
faoAreas = listOf("27.4.a"),
seizureAndDiversion = false,
speciesOnboard = getSpecies(listOf("JAX", "CRF")),
speciesInfractions = listOf(),
isDeleted = false,
hasSomeGearsSeized = false,
hasSomeSpeciesSeized = false,
isFromPoseidon = false,
completion = Completion.TO_COMPLETE,
flagState = CountryCode.GB,
userTrigram = "LTH",
)

// When
val faoArea = jdp.getFirstFaoAreaIncludedInJdp(control)

// Then
when (jdp) {
JointDeploymentPlan.MEDITERRANEAN_AND_EASTERN_ATLANTIC -> assertThat(faoArea?.faoCode).isNull()
JointDeploymentPlan.NORTH_SEA -> assertThat(faoArea?.faoCode).isEqualTo("27.4.a")
JointDeploymentPlan.WESTERN_WATERS -> assertThat(faoArea?.faoCode).isNull()
}
}

private fun getSpecies(species: List<String>): List<SpeciesControl> {
return species.map {
val specy = SpeciesControl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const JDP_CSV_MAP_BASE: DownloadAsCsvMap<ActivityReportWithId> = {
},
faoArea: {
label: 'FAO_AREA_CODE',
transform: activity => activity.faoCode ?? ''
transform: activity => activity.faoArea ?? ''
},
fleetSegment: {
label: 'FLEET_SEGMENT',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/ActivityReport/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type ActivityReport = {
action: MissionAction.MissionAction
activityCode: ActivityCode
controlUnits: LegacyControlUnit.LegacyControlUnit[]
faoCode: string | undefined
faoArea: string | undefined
segment: string | undefined
vessel: Vessel.Vessel
vesselNationalIdentifier: string
Expand Down

0 comments on commit 58857df

Please sign in to comment.