-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #568 from disneystreaming/issue-501
Build http4s routers lazily
- Loading branch information
Showing
2 changed files
with
49 additions
and
10 deletions.
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
34 changes: 34 additions & 0 deletions
34
modules/http4s/test/src/smithy4s/http4s/ProtocolBuilderSpec.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,34 @@ | ||
package smithy4s.http4s | ||
|
||
import cats.effect.IO | ||
import org.http4s.HttpApp | ||
import org.http4s.client.Client | ||
import smithy4s.example.PizzaAdminServiceGen | ||
import smithy4s.example.WeatherGen | ||
import weaver._ | ||
|
||
object ProtocolBuilderSpec extends FunSuite { | ||
|
||
private val fakeClient = Client.fromHttpApp(HttpApp.notFound[IO]) | ||
|
||
test( | ||
"SimpleProtocolBuilder (client) fails when the protocol is not present" | ||
) { | ||
val result = SimpleRestJsonBuilder(WeatherGen) | ||
.client(fakeClient) | ||
.use | ||
|
||
assert(result.isLeft) | ||
} | ||
|
||
test( | ||
"SimpleProtocolBuilder (client) succeeds when the protocol is present" | ||
) { | ||
val result = SimpleRestJsonBuilder(PizzaAdminServiceGen) | ||
.client(fakeClient) | ||
.use | ||
|
||
assert(result.isRight) | ||
} | ||
|
||
} |