Skip to content

Commit

Permalink
Start of test tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed May 25, 2024
1 parent c0d0582 commit e914870
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 181 deletions.
2 changes: 1 addition & 1 deletion project/src/build.runner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def buildRunnerScli(
.chunks
.evalMap(
aChunk =>
if aChunk.toString.contains("node ./") then
if aChunk.toString.contains("main.js, run it with") then
logger.trace("Detected that linking was successful, emitting refresh event") >>
refreshTopic.publish1("refresh")
else
Expand Down
42 changes: 21 additions & 21 deletions project/src/routes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,27 @@ object ETagMiddleware:
req.headers.get(ci"If-None-Match") match
case Some(header) =>
val etag = header.head.value
OptionT.liftF(logger.debug(req.uri.toString)) >>
OptionT.liftF(logger.debug(etag)) >>
service(req).semiflatMap {
resp =>
mr.get
.flatMap {
map =>
map.get(req.uri.path.toString.drop(1)) match
case Some(foundEt) =>
if etag == foundEt then
logger.debug("ETag matches, returning 304") >>
IO(Response[IO](Status.NotModified))
else
logger.debug(etag) >>
logger.debug("ETag doesn't match, returning 200") >>
respondWithEtag(resp)
end if
case None =>
respondWithEtag(resp)
}
}
// OptionT.liftF(logger.debug(req.uri.toString)) >>
// OptionT.liftF(logger.debug(etag)) >>
service(req).semiflatMap {
resp =>
mr.get
.flatMap {
map =>
map.get(req.uri.path.toString.drop(1)) match
case Some(foundEt) =>
if etag == foundEt then
logger.debug("ETag matches, returning 304") >>
IO(Response[IO](Status.NotModified))
else
logger.debug(etag) >>
logger.debug("ETag doesn't match, returning 200") >>
respondWithEtag(resp)
end if
case None =>
respondWithEtag(resp)
}
}
case _ =>
OptionT.liftF(logger.debug("No headers in query, service it")) >>
service(req).semiflatMap {
Expand Down
1 change: 0 additions & 1 deletion project/test/src/UtilityFcts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class UtilityFcs extends munit.FunSuite:

test(" That we can inject a refresh script") {
val html = injectRefreshScript("<html><head></head><body></body></html>")
println(html)
assert(
html.contains("sse.addEventListener")
)
Expand Down
Loading

0 comments on commit e914870

Please sign in to comment.