-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve formatting of UnexpectedResponse.getMessage
This lists each header of the response on its own line instead of having them all on one line.
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
modules/core/src/test/scala/org/scalasteward/core/util/UnexpectedResponseTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.scalasteward.core.util | ||
|
||
import munit.FunSuite | ||
import org.http4s.{Header, Headers, Method, Status, Uri} | ||
import org.typelevel.ci.CIString | ||
|
||
class UnexpectedResponseTest extends FunSuite { | ||
test("getMessage") { | ||
val unexpected = UnexpectedResponse( | ||
Uri.unsafeFromString("https://api.github.com/repos/foo/bar/pulls"), | ||
Method.POST, | ||
Headers( | ||
Header.Raw(CIString("access-control-allow-origin"), "*"), | ||
Header.Raw(CIString("content-type"), "application/json; charset=utf-8") | ||
), | ||
Status.Forbidden, | ||
"""{ message: "nope" }""" | ||
) | ||
val expected = | ||
"""|uri: https://api.github.com/repos/foo/bar/pulls | ||
|method: POST | ||
|status: 403 Forbidden | ||
|headers: | ||
| access-control-allow-origin: * | ||
| content-type: application/json; charset=utf-8 | ||
|body: { message: "nope" }""".stripMargin | ||
assertEquals(unexpected.getMessage, expected) | ||
} | ||
} |