Skip to content

Commit

Permalink
Fix few tests
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Aug 9, 2024
1 parent d1cffb5 commit 68bc2a4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class FleetSegmentController(
}

@ResponseStatus(HttpStatus.CREATED)
@PostMapping("/{year}")
@PostMapping("/backoffice/{year}")
@Operation(summary = "Add a fleet segment year")
fun addFleetSegmentYear(
@PathParam("Year")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FleetSegmentControllerITests {

// When
api.perform(
put("/bff/v1/fleet_segments?year=2021&segment=A_SEGMENT/WITH/SLASH")
put("/bff/v1/fleet_segments/backoffice?year=2021&segment=A_SEGMENT/WITH/SLASH")
.content(
objectMapper.writeValueAsString(CreateOrUpdateFleetSegmentDataInput(gears = listOf("OTB", "OTC"))),
)
Expand All @@ -113,15 +113,15 @@ class FleetSegmentControllerITests {
@Test
fun `Should return Ok When a delete of a fleet segment is done`() {
// When
api.perform(delete("/bff/v1/fleet_segments?year=2021&segment=A_SEGMENT/WITH/SLASH"))
api.perform(delete("/bff/v1/fleet_segments/backoffice?year=2021&segment=A_SEGMENT/WITH/SLASH"))
// Then
.andExpect(status().isOk)
}

@Test
fun `Should return Ok When a new year is created`() {
// When
api.perform(post("/bff/v1/fleet_segments/2023"))
api.perform(post("/bff/v1/fleet_segments/backoffice/2023"))
// Then
.andExpect(status().isCreated)
}
Expand All @@ -136,7 +136,7 @@ class FleetSegmentControllerITests {

// When
api.perform(
post("/bff/v1/fleet_segments")
post("/bff/v1/fleet_segments/backoffice")
.content(
objectMapper.writeValueAsString(
CreateOrUpdateFleetSegmentDataInput(
Expand Down Expand Up @@ -164,7 +164,7 @@ class FleetSegmentControllerITests {

// When
api.perform(
post("/bff/v1/fleet_segments")
post("/bff/v1/fleet_segments/backoffice")
.content(
objectMapper.writeValueAsString(
CreateOrUpdateFleetSegmentDataInput(segment = "SEGMENT", gears = listOf("OTB", "OTC")),
Expand Down
10 changes: 6 additions & 4 deletions frontend/cypress/e2e/backoffice/fleet_segments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dayjs.extend(utc)
const currentYear = dayjs().utc().year()
context('Fleet segments', () => {
beforeEach(() => {
cy.intercept('GET', `/bff/v1/fleet_segments/${currentYear}`).as('fleetSegments')
cy.intercept('GET', `/bff/v1/fleet_segments/backoffice/${currentYear}`).as('fleetSegments')
cy.visit('/backoffice/fleet_segments')
cy.wait('@fleetSegments')
cy.wait(1000)
Expand All @@ -35,7 +35,7 @@ context('Fleet segments', () => {
cy.log('Should update the segment')

// When
cy.intercept('PUT', `/bff/v1/fleet_segments?year=${currentYear}&segment=ATL01`).as('updateFleetSegment')
cy.intercept('PUT', `/bff/v1/fleet_segments/backoffice?year=${currentYear}&segment=ATL01`).as('updateFleetSegment')

cy.get('[aria-rowindex="2"]').find('[title="Editer la ligne"]').click()
cy.fill('Nom', 'ATL036')
Expand Down Expand Up @@ -92,7 +92,7 @@ context('Fleet segments', () => {

it('Should create a new fleet segment and delete it', () => {
// Given
cy.intercept('POST', '/bff/v1/fleet_segments').as('createFleetSegment')
cy.intercept('POST', '/bff/v1/fleet_segments/backoffice').as('createFleetSegment')

// When
cy.clickButton('Ajouter un segment')
Expand Down Expand Up @@ -137,7 +137,9 @@ context('Fleet segments', () => {
// -------------------------------------------------------------------------
cy.log('Should delete a fleet segment')

cy.intercept('DELETE', `/bff/v1/fleet_segments?year=${currentYear}&segment=ABC123`).as('deleteFleetSegment')
cy.intercept('DELETE', `/bff/v1/fleet_segments/backoffice?year=${currentYear}&segment=ABC123`).as(
'deleteFleetSegment'
)
cy.get('[aria-rowindex="2"]').find('[title="Supprimer la ligne"]').click()
cy.wait('@deleteFleetSegment')

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ interface ImportMetaEnv {
readonly FRONTEND_OIDC_AUTHORITY: string
readonly FRONTEND_OIDC_CLIENT_ID: string
readonly FRONTEND_OIDC_ENABLED: string
readonly FRONTEND_OIDC_REDIRECT_URI: string
readonly FRONTEND_OIDC_LOGOUT_REDIRECT_URI: string
readonly FRONTEND_OIDC_REDIRECT_URI: string
readonly FRONTEND_PRIOR_NOTIFICATION_LIST_ENABLED: string
readonly FRONTEND_SENTRY_DSN?: string
readonly FRONTEND_SENTRY_ENV?: string
Expand Down

0 comments on commit 68bc2a4

Please sign in to comment.