Skip to content

Commit

Permalink
Reformat with scalafmt 3.8.5
Browse files Browse the repository at this point in the history
Executed command: scalafmt --non-interactive
  • Loading branch information
scala-steward committed Jan 19, 2025
1 parent 2f1f192 commit 249ca6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@ class ValidScopeTest extends AnyWordSpec with Matchers {
val allowedChars: List[Char] = 33.toChar +: List(' ') ::: (35 to 91).map(_.toChar).toList ::: (93 to 125).map(_.toChar).toList

"Scope" should {
"be created according to RFC allowed characters" in {
"be created according to RFC allowed characters" in
assert(
refineV[ValidScope](allowedChars.mkString("")).toOption ===
Scope.of("! #$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}")
)
}

"not be created for empty string" in {
"not be created for empty string" in
assert(refineV[ValidScope]("") === Left("""Predicate failed: "" matches ValidScope."""))
}

"not be created for characters outside allowed range" in {
"not be created for characters outside allowed range" in
assert(refineV[ValidScope](""" "\""") === Left("""Predicate failed: " "\" matches ValidScope."""))
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
private def check[A <: OAuth2Error](json: String, deserialized: A) =
JsonDecoder[OAuth2Error].decodeString(json) shouldBe Right(deserialized)

"invalid_request error JSON" should "be deserialized to InvalidRequest" in {
"invalid_request error JSON" should "be deserialized to InvalidRequest" in
check(
// language=JSON
"""
Expand All @@ -34,9 +34,8 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
""",
OAuth2ErrorResponse(InvalidRequest, Some("Grant type is missing."))
)
}

"invalid_client error JSON" should "be deserialized to InvalidClient" in {
"invalid_client error JSON" should "be deserialized to InvalidClient" in
check(
// language=JSON
"""
Expand All @@ -48,9 +47,8 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
""",
OAuth2ErrorResponse(InvalidClient, Some("Client is missing or invalid."))
)
}

"invalid_grant error JSON" should "be deserialized to InvalidGrant" in {
"invalid_grant error JSON" should "be deserialized to InvalidGrant" in
check(
// language=JSON
"""
Expand All @@ -62,9 +60,8 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
""",
OAuth2ErrorResponse(InvalidGrant, Some("Provided domain cannot be used with given grant type."))
)
}

"unauthorized_client error JSON" should "be deserialized to UnauthorizedClient" in {
"unauthorized_client error JSON" should "be deserialized to UnauthorizedClient" in
check(
// language=JSON
"""
Expand All @@ -76,9 +73,8 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
""",
OAuth2ErrorResponse(UnauthorizedClient, Some("Client is not allowed to use provided grant type."))
)
}

"unsupported_grant_type error JSON" should "be deserialized to InvalidGrant" in {
"unsupported_grant_type error JSON" should "be deserialized to InvalidGrant" in
check(
// language=JSON
"""
Expand All @@ -90,9 +86,8 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
""",
OAuth2ErrorResponse(UnsupportedGrantType, Some("Requested grant type is invalid."))
)
}

"invalid_scope error JSON" should "be deserialized to InvalidGrant" in {
"invalid_scope error JSON" should "be deserialized to InvalidGrant" in
check(
// language=JSON
"""
Expand All @@ -104,9 +99,8 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
""",
OAuth2ErrorResponse(InvalidScope, Some("Client is not allowed to use requested scope."))
)
}

"invalid_token error JSON" should "be deserialized to Unknown" in {
"invalid_token error JSON" should "be deserialized to Unknown" in
check(
// language=JSON
"""
Expand All @@ -118,9 +112,8 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
""",
UnknownOAuth2Error(error = "invalid_token", Some("Invalid access token."))
)
}

"insufficient_scope error JSON" should "be deserialized to Unknown" in {
"insufficient_scope error JSON" should "be deserialized to Unknown" in
check(
// language=JSON
"""
Expand All @@ -132,9 +125,8 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
""",
UnknownOAuth2Error(error = "insufficient_scope", Some("Access token does not contain requested scope."))
)
}

"unknown error JSON" should "be deserialized to Unknown" in {
"unknown error JSON" should "be deserialized to Unknown" in
check(
// language=JSON
"""
Expand All @@ -146,7 +138,6 @@ trait OAuth2ErrorDeserializationSpec extends AnyFlatSpecLike with Matchers with
""",
UnknownOAuth2Error(error = "unknown_error", errorDescription = Some("I don't know this error type."))
)
}

"JSON in wrong format" should "not be deserialized" in {
val json =
Expand Down

0 comments on commit 249ca6d

Please sign in to comment.