Skip to content

Commit

Permalink
Fix unit test and ts types
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Jan 9, 2025
1 parent 2ecccb1 commit 9de6386
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class JpaControlObjectivesRepositoryITests : AbstractDBTests() {
assertThat(jpaControlObjectivesRepository.findAllByYear(lastYear)).hasSize(62)
val updatedControlObjectives = jpaControlObjectivesRepository.findAllByYear(nextYear)
assertThat(updatedControlObjectives).hasSize(62)
assertThat(updatedControlObjectives.first().id).isEqualTo(125)
assertThat(updatedControlObjectives.first().id).isEqualTo(144)
assertThat(updatedControlObjectives.first().year).isEqualTo(nextYear)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,8 @@ class JpaFleetSegmentRepositoryITests : AbstractDBTests() {

assertThat(gears).hasSize(26)
assertThat(gears).isEqualTo(
listOf(
"PTM", "GTN", "PTB", "GNF", "TBB", "TBS", "OTT", "TB", "SDN", "TM", "SSC", "OTM", "GTR", "GNC", "SX",
"TBN", "PT", "GN", "SV", "TX", "GEN", "SPR", "GNS", "OT", "TMS", "OTB",
listOf("SV", "OTB", "TBB", "GTR", "PTB", "TMS", "OTT", "TM", "OTM", "GNC", "SX", "TBS", "SSC", "TBN",
"OT", "PTM", "TX", "SPR", "GNS", "TB", "SDN", "PT", "GN", "GEN", "GTN", "GNF",
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Table } from 'rsuite'
import { getAllGearCodes } from '../../../../domain/use_cases/gearCode/getAllGearCodes'
import { getAllSpecies } from '../../../../domain/use_cases/species/getAllSpecies'

import type { FleetSegment, UpdateFleetSegment } from '@features/FleetSegment/types'
import type { FleetSegment } from '@features/FleetSegment/types'
import type { MainAppAsyncThunk } from '@store'

const { Cell, Column, HeaderCell } = Table
Expand All @@ -17,7 +17,7 @@ type FleetSegmentsTableProps = Readonly<{
faoAreas: string[]
fleetSegments: FleetSegment[]
onDeleteFleetSegment: (segment: string, year: number) => void
openEditFleetSegmentModal: (segment: string, year: number, nextFleetSegment: UpdateFleetSegment) => Promise<void>
openEditFleetSegmentModal: (fleetSegment: FleetSegment) => void
}>
export function FleetSegmentsTable({
faoAreas,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@ export function getTripSegments(
}

export function getSegmentInfo(segment: Partial<FleetSegment>): string {
if (segment.gears ?? segment.faoAreas ?? segment.targetSpecies ?? segment.bycatchSpecies) {
if (segment.gears ?? segment.faoAreas ?? segment.targetSpecies) {
const gears = segment.gears?.length ? segment.gears.join(', ') : 'aucun'
const faoAreas = segment.faoAreas?.length ? segment.faoAreas.join(', ') : 'aucune'

let targetSpeciesArray: string[] = []
if (segment.targetSpecies?.length) {
targetSpeciesArray = targetSpeciesArray.concat(segment.targetSpecies)
}
if (segment.bycatchSpecies?.length) {
targetSpeciesArray = targetSpeciesArray.concat(segment.bycatchSpecies)
}
const targetSpecies = targetSpeciesArray.length ? targetSpeciesArray.join(', ') : 'aucune'

return `Engins: ${gears}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { RiskFactorBox } from '@features/Vessel/components/VesselSidebar/risk_fa
import type { InnerCellProps } from 'rsuite-table/lib/Cell'

const { Cell } = Table
const rowKey = 'id'
export const INPUT_TYPE = {
DOUBLE: 'DOUBLE',
INT: 'INT',
Expand Down

0 comments on commit 9de6386

Please sign in to comment.