Skip to content

Commit

Permalink
Code golf
Browse files Browse the repository at this point in the history
Thanks Max (a.k.a Masynchin)
  • Loading branch information
lenguyenthanh committed Feb 1, 2025
1 parent 2a3783f commit 3010f83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules/crawler/src/main/scala/Downloader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object Downloader:
.through(fs2.text.lines)
.drop(1) // first line is header
.evalMap(parseLine)
.collect { case Some(x) => x }
.unNone

def parseLine(line: String): Logger[IO] ?=> IO[Option[(NewPlayer, Option[NewFederation])]] =

Expand Down
8 changes: 4 additions & 4 deletions modules/crawler/src/test/scala/DownloaderTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ object DownloaderTest extends SimpleIOSuite:
.build
.use: client =>
Downloader(client).fetch
.map(x => x._2)
.fold[Set[FederationId]](Set.empty)((acc, x) => acc ++ x.map(_.id))
.map(x => x._2.map(_.id))
.unNone
.compile
.last
.map(x => Federation.all.keySet.diff(x.get))
.to(Set)
.map(Federation.all.keySet.diff)
.map(x => expect(x == Set.empty))

0 comments on commit 3010f83

Please sign in to comment.