Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-in-a-Jar committed Feb 1, 2024
1 parent 5e01ab4 commit f5d444c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ object AdminUpdateUserRequest {
azureB2CId: Option[AzureB2CId],
googleSubjectId: Option[GoogleSubjectId]
): AdminUpdateUserRequest =
AdminUpdateUserRequest(azureB2CId, googleSubjectId)
new AdminUpdateUserRequest(azureB2CId, googleSubjectId)
}
@Lenses final case class AdminUpdateUserRequest(
azureB2CId: Option[AzureB2CId],
googleSubjectId: Option[GoogleSubjectId]
) {
val UUID_REGEX =
private val UUID_REGEX =
Pattern.compile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
private def validateAzureB2CId(azureB2CId: AzureB2CId): Option[ErrorReport] =
if (!UUID_REGEX.matcher(azureB2CId.value).matches() && !(azureB2CId.value == "null")) {
Expand All @@ -35,9 +35,9 @@ object AdminUpdateUserRequest {
var errorReports = Seq[ErrorReport]()
azureB2CId.foreach(azureB2CId => errorReports = errorReports ++ validateAzureB2CId(azureB2CId))
if (azureB2CId.contains(AzureB2CId("null")) && user.googleSubjectId.isEmpty)
errorReports = errorReports ++ Seq(ErrorReport(StatusCodes.BadRequest, "Unable to null azureB2CId when the user's googleSubjectId is already null"))
errorReports = errorReports ++ Seq(ErrorReport(StatusCodes.BadRequest, "Unable to null azureB2CId when the user's googleSubjectId is already null."))
else if (googleSubjectId.contains(GoogleSubjectId("null")) && user.azureB2CId.isEmpty)
errorReports = errorReports ++ Seq(ErrorReport(StatusCodes.BadRequest, "Unable to null googleSubjectId when the user's azureB2CId is already null"))
errorReports = errorReports ++ Seq(ErrorReport(StatusCodes.BadRequest, "Unable to null googleSubjectId when the user's azureB2CId is already null."))
errorReports
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class UpdateUserSpec extends UserServiceTestTraits {
"Nulling a user's azureB2CId when the user has no googleSubjectId should have a Bad Request status"
)
assert(
error.errorReport.message equals "Cannot null a user's azureB2CId when the user has no googleSubjectId",
error.errorReport.causes.head.message equals "Unable to null azureB2CId when the user's googleSubjectId is already null.",
"Nulling a user's azureB2CId when the user has no googleSubjectId should send back a invalid update message"
)
}
Expand Down Expand Up @@ -153,7 +153,7 @@ class UpdateUserSpec extends UserServiceTestTraits {
"Nulling a user's googleSubjectId when the user has no azureB2CId should have a Bad Request status"
)
assert(
error.errorReport.message equals "Cannot null a user's azureB2CId when the user has no googleSubjectId",
error.errorReport.causes.head.message equals "Unable to null googleSubjectId when the user's azureB2CId is already null.",
"Nulling a user's azureB2CId when the user has no googleSubjectId should send back a invalid update message"
)
}
Expand Down

0 comments on commit f5d444c

Please sign in to comment.