Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mission] Résolution du bug à l'enregistrement d'une mission clôturée #928

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,33 @@ context('Mission', () => {
cy.get('*[data-cy="SideWindowHeader-title"]').contains('Missions et contrôles')
})

it('A closed mission can be saved and stay closed', () => {
// Given
cy.wait(200)
cy.get('*[data-cy="edit-mission-43"]').click({ force: true })
cy.intercept('PUT', '/bff/v1/missions/43').as('updateMission')
cy.clickButton('Enregistrer et quitter')

// Then
cy.wait('@updateMission').then(({ response }) => {
expect(response && response.statusCode).equal(200)
expect(response && response.body.isClosed).equal(true)
})
})

it('A warning should be displayed When a control unit is already engaged in a mission ', () => {
// Given
cy.wait(200)
cy.intercept('GET', '/api/v1/missions/engaged_control_units').as('getEngagedControlUnits')

// When
cy.get('*[data-cy="edit-mission-43"]').click({ force: true })
cy.wait('@getEngagedControlUnits')

// Then
cy.get('body').contains('Cette unité est actuellement sélectionnée dans une autre mission en cours.')
})

it('A mission from monitorFish cannot be deleted', () => {
// Given
cy.wait(200)
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/missions/MissionForm/MissionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ export function MissionForm({ id, isNewMission, selectedMission, setShouldValida
const submitMission = () => {
setShouldValidateOnChange(false)

validateForm({ ...values, isClosed: false }).then(errors => {
validateForm().then(errors => {
if (_.isEmpty(errors)) {
dispatch(saveMission({ ...values, isClosed: false }))
dispatch(saveMission(values))

return
}
Expand Down
Loading