-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Avaries VMS] Correction de bugs mineurs (#2497)
## Linked issues - Resolve #2401 - Resove #2402 ### Backoffice - segments de flottes - Resolve #2486 - Resolve #2487 ---- - [ ] Tests E2E (Cypress)
- Loading branch information
Showing
8 changed files
with
94 additions
and
14 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
frontend/src/domain/entities/beaconMalfunction/__tests__/getMalfunctionStartDateText.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { expect } from '@jest/globals' | ||
|
||
import { BeaconMalfunctionVesselStatus, EndOfBeaconMalfunctionReason } from '../constants' | ||
import { getMalfunctionStartDateText } from '../index' | ||
|
||
describe('domain/entities/beaconMalfunction/index.getMalfunctionStartDateText()', () => { | ||
it('should return the right status', () => { | ||
const beaconMalfunction = { | ||
beaconNumber: 'NOT_FOUND', | ||
endOfBeaconMalfunctionReason: EndOfBeaconMalfunctionReason.BEACON_DEACTIVATED_OR_UNEQUIPPED, | ||
externalReferenceNumber: '08FR65465', | ||
flagState: 'FR', | ||
id: 5, | ||
internalReferenceNumber: 'FR263465414', | ||
ircs: 'IR123', | ||
malfunctionEndDateTime: null, | ||
malfunctionStartDateTime: '2023-08-21T11:17:22.997231Z', | ||
notificationRequested: null, | ||
riskFactor: null, | ||
stage: 'ARCHIVED', | ||
vesselId: 12, | ||
vesselIdentifier: 'EXTERNAL_REFERENCE_NUMBER', | ||
vesselName: 'LE b@TO 2', | ||
vesselStatus: BeaconMalfunctionVesselStatus.ON_SALE, | ||
vesselStatusLastModificationDateTime: '2023-08-28T11:17:22.997231Z' | ||
} | ||
|
||
const result = getMalfunctionStartDateText(beaconMalfunction) | ||
|
||
expect(result).toEqual('Balise désactivée') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
frontend/src/features/SideWindow/BeaconMalfunctionBoard/__tests__/getActionText.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { expect } from '@jest/globals' | ||
import { render } from '@testing-library/react' | ||
|
||
import { | ||
BeaconMalfunctionPropertyName, | ||
BeaconMalfunctionsStage, | ||
EndOfBeaconMalfunctionReason | ||
} from '../../../../domain/entities/beaconMalfunction/constants' | ||
import { getActionText } from '../beaconMalfunctions' | ||
|
||
describe('features/SideWindow/BeaconMalfunctionBoard/beaconMalfunctions.tsx/getActionText()', () => { | ||
it('should not show the end of malfunction reason when the stage value is not an end column', () => { | ||
const reason = EndOfBeaconMalfunctionReason.BEACON_DEACTIVATED_OR_UNEQUIPPED | ||
const action = { | ||
beaconMalfunctionId: 9149, | ||
dateTime: '2022-12-05T07:53:07.39248Z', | ||
nextValue: BeaconMalfunctionsStage.FOLLOWING, | ||
previousValue: BeaconMalfunctionsStage.AT_QUAY, | ||
propertyName: BeaconMalfunctionPropertyName.STAGE | ||
} | ||
|
||
const result = getActionText(action, reason) | ||
|
||
const { container } = render(result) | ||
expect(container.textContent).toContain('Le ticket a été déplacé') | ||
expect(container.textContent).not.toContain('Il a été clôturé pour cause') | ||
}) | ||
|
||
it('should show the end of malfunction reason when the stage value is an end column', () => { | ||
const reason = EndOfBeaconMalfunctionReason.BEACON_DEACTIVATED_OR_UNEQUIPPED | ||
const action = { | ||
beaconMalfunctionId: 9149, | ||
dateTime: '2022-12-05T07:53:07.39248Z', | ||
nextValue: BeaconMalfunctionsStage.ARCHIVED, | ||
previousValue: BeaconMalfunctionsStage.AT_QUAY, | ||
propertyName: BeaconMalfunctionPropertyName.STAGE | ||
} | ||
|
||
const result = getActionText(action, reason) | ||
|
||
const { container } = render(result) | ||
expect(container.textContent).toContain('Le ticket a été déplacé') | ||
expect(container.textContent).toContain('Il a été clôturé pour cause') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters