Skip to content

Commit

Permalink
relent and make the field optional for now
Browse files Browse the repository at this point in the history
  • Loading branch information
tlangs committed Sep 11, 2023
1 parent 62a8b6c commit b197c5e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ case class BasicProfile (
programLocationCountry: String,
termsOfService: Option[String],
researchArea: Option[String],
department: String = "N/A",
department: Option[String],
interestInTerra: Option[String],
) extends mappedPropVals {
require(ProfileValidator.nonEmpty(firstName), "first name must be non-empty")
Expand All @@ -56,7 +56,7 @@ case class Profile (
researchArea: Option[String],
linkedNihUsername: Option[String] = None,
linkExpireTime: Option[Long] = None,
department: String = "N/A",
department: Option[String],
interestInTerra: Option[String],
) extends mappedPropVals {
require(ProfileValidator.nonEmpty(firstName), "first name must be non-empty")
Expand All @@ -67,7 +67,6 @@ case class Profile (
require(ProfileValidator.nonEmpty(programLocationCity), "program location city must be non-empty")
require(ProfileValidator.nonEmpty(programLocationState), "program location state must be non-empty")
require(ProfileValidator.nonEmpty(programLocationCountry), "program location country must be non-empty")
require(ProfileValidator.nonEmpty(department), "department must be non-empty")
}

object Profile {
Expand Down Expand Up @@ -102,7 +101,7 @@ object Profile {
case Some(time) => Some(time.toLong)
case _ => None
},
department = mappedKVPs("department"),
department = mappedKVPs.get("department"),
interestInTerra = mappedKVPs.get("interestInTerra")
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProfileSpec extends AnyFreeSpec with Matchers {
programLocationState = randomString,
programLocationCountry = randomString,
termsOfService = Some(termsOfServiceUrl),
department = randomString,
department = Some(randomString),
interestInTerra = Some(randomString)
)
basicProfile shouldNot be(null)
Expand All @@ -41,7 +41,7 @@ class ProfileSpec extends AnyFreeSpec with Matchers {
programLocationState = randomString,
programLocationCountry = randomString,
termsOfService = Some(termsOfServiceUrl),
department = randomString,
department = Some(randomString),
interestInTerra = Some(randomString)
)
basicProfile shouldNot be(null)
Expand All @@ -57,7 +57,7 @@ class ProfileSpec extends AnyFreeSpec with Matchers {
programLocationCity = randomString,
programLocationState = randomString,
programLocationCountry = randomString,
department = randomString,
department = Some(randomString),
interestInTerra = Some(randomString)
)
profile shouldNot be(null)
Expand All @@ -73,7 +73,7 @@ class ProfileSpec extends AnyFreeSpec with Matchers {
programLocationCity = randomString,
programLocationState = randomString,
programLocationCountry = randomString,
department = randomString,
department = Some(randomString),
interestInTerra = Some(randomString)
)
profile shouldNot be(null)
Expand All @@ -89,7 +89,7 @@ class ProfileSpec extends AnyFreeSpec with Matchers {
programLocationCity = randomString,
programLocationState = randomString,
programLocationCountry = randomString,
department = randomString,
department = Some(randomString),
interestInTerra = Some(randomString)
)
profile shouldNot be(null)
Expand All @@ -110,7 +110,7 @@ class ProfileSpec extends AnyFreeSpec with Matchers {
programLocationCountry = "",
None,
None,
"",
None,
None
)
}
Expand All @@ -128,7 +128,7 @@ class ProfileSpec extends AnyFreeSpec with Matchers {
programLocationCity = randomString,
programLocationState = randomString,
programLocationCountry = randomString,
department = randomString,
department = Some(randomString),
interestInTerra = Some(randomString)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ final class RegisterApiServiceSpec extends BaseServiceSpec with RegisterApiServi
programLocationState = randomString,
programLocationCountry = randomString,
termsOfService = if (hasTermsOfService) Some(termsOfServiceUrl) else None,
department = randomString,
department = Some(randomString),
interestInTerra = Some(randomString)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class UserApiServiceSpec extends BaseServiceSpec with SamMockserverUtils
programLocationState = randomAlpha(),
programLocationCountry = randomAlpha(),
termsOfService = None,
department = randomAlpha(),
department = Some(randomAlpha()),
interestInTerra = Some(randomAlpha())
)
val allProperties: Map[String, String] = fullProfile.propertyValueMap
Expand Down

0 comments on commit b197c5e

Please sign in to comment.