Skip to content

Commit

Permalink
PRSD-689: Updates affected tests
Browse files Browse the repository at this point in the history
  • Loading branch information
isobel-softwire committed Feb 27, 2025
1 parent ecf54f7 commit 90bd1dc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ abstract class Journey<T : StepId>(
principal: Principal,
journeyDataKey: String = journeyType.name,
): String {
journeyDataService.journeyDataKey = journeyDataKey
val currentStep = getStep(stepId)
if (!currentStep.isSatisfied(validator, pageData)) {
return populateModelAndGetViewName(stepId, model, subPageNumber, journeyDataKey, pageData)
}
journeyDataService.journeyDataKey = journeyDataKey
val journeyData = journeyDataService.getJourneyDataFromSession()
val newJourneyData = currentStep.updatedJourneyData(journeyData, pageData, subPageNumber)
journeyDataService.setJourneyDataInSession(newJourneyData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RegisterLAUserControllerTests(

verify(invitationService).tokenIsValid(validToken)
verify(invitationService).storeTokenInSession(validToken)
verify(laUserRegistrationJourney).initialiseJourneyData(validToken)
verify(laUserRegistrationJourney).initialiseJourneyData(validToken, JourneyType.LA_USER_REGISTRATION.name)
}

@Test
Expand All @@ -70,7 +70,10 @@ class RegisterLAUserControllerTests(

verify(invitationService).tokenIsValid(invalidToken)
verify(invitationService, never()).storeTokenInSession(invalidToken)
verify(laUserRegistrationJourney, never()).initialiseJourneyData(validToken)
verify(laUserRegistrationJourney, never()).initialiseJourneyData(
validToken,
JourneyType.LA_USER_REGISTRATION.name,
)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ class JourneyTests {
mockOneLoginUserRepository,
ObjectMapper(),
)
journeyDataService.journeyDataKey = "test-journey-key"
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class TaskListTests {
override val initialStepId: TestStepId,
override val sections: List<JourneySection<TestStepId>>,
) : JourneyWithTaskList<TestStepId>(JourneyType.PROPERTY_REGISTRATION, validator, journeyDataService) {
override val journeyPathSegment = "any-url-segment"
override val taskListFactory: TaskListViewModelFactory<TestStepId>
get() =
getTaskListViewModelFactory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.springframework.test.util.ReflectionTestUtils
import org.springframework.test.web.servlet.get
import org.springframework.test.web.servlet.post
import org.springframework.web.context.WebApplicationContext
import uk.gov.communities.prsdb.webapp.constants.enums.JourneyType
import uk.gov.communities.prsdb.webapp.controllers.ControllerTest
import uk.gov.communities.prsdb.webapp.controllers.ManageLocalAuthorityUsersController
import uk.gov.communities.prsdb.webapp.controllers.RegisterLAUserController
Expand Down Expand Up @@ -80,6 +81,7 @@ class InvitationUrlTests(
val encodedConfirmedEmailContent = urlEncodedConfirmedEmailDataModel(testEmail)

whenever(laUserRegistrationJourney.initialStepId).thenReturn(RegisterLaUserStepId.LandingPage)
whenever(laUserRegistrationJourney.journeyType).thenReturn(JourneyType.LA_USER_REGISTRATION)

// Act
mvc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package uk.gov.communities.prsdb.webapp.mockObjects

import org.mockito.kotlin.any
import org.mockito.kotlin.eq
import org.mockito.kotlin.whenever
import uk.gov.communities.prsdb.webapp.constants.MANUAL_ADDRESS_CHOSEN
import uk.gov.communities.prsdb.webapp.constants.enums.LicensingType
Expand Down Expand Up @@ -121,7 +119,7 @@ class JourneyDataBuilder(
localAuthority: LocalAuthority,
isContactAddress: Boolean = false,
): JourneyDataBuilder {
whenever(mockAddressDataService.getAddressData(any(), eq(singleLineAddress))).thenReturn(
whenever(mockAddressDataService.getAddressData(singleLineAddress)).thenReturn(
AddressDataModel(
singleLineAddress,
localAuthorityId = localAuthority.id,
Expand Down

0 comments on commit 90bd1dc

Please sign in to comment.