Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Symbol to shared together with jvm specific domain tests. #264

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .sbtopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-J-Xmx2G
-J-XX:+UseG1GC
22 changes: 11 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ val commonSettings = List(
Libraries.kittens.value,
Libraries.ip4sCore.value,
Libraries.monocleCore.value,
Libraries.catsLaws % Test,
Libraries.monocleLaw % Test,
Libraries.scalacheck % Test,
Libraries.weaverCats % Test,
Libraries.weaverDiscipline % Test,
Libraries.weaverScalaCheck % Test
Libraries.ironCore.value,
Libraries.ironCats.value,
Libraries.ironCirce.value,
Libraries.catsLaws.value % Test,
Libraries.monocleLaw.value % Test,
Libraries.scalacheck.value % Test,
Libraries.weaverCats.value % Test,
Libraries.weaverDiscipline.value % Test,
Libraries.weaverScalaCheck.value % Test
)
)

Expand All @@ -71,9 +74,6 @@ val commonJvmSettings = List(
Libraries.http4sDsl,
Libraries.http4sMetrics,
Libraries.http4sServer,
Libraries.ironCore.value,
Libraries.ironCats.value,
Libraries.ironCirce.value,
Libraries.neutronCore,
Libraries.odin,
Libraries.redis4catsEffects
Expand All @@ -99,7 +99,7 @@ lazy val domain = crossProject(JSPlatform, JVMPlatform)
.settings(commonSettings: _*)
.jvmSettings(commonJvmSettings)
.jsSettings(
test := {},
libraryDependencies += Libraries.scalajsTime.value,
scalacOptions := List("-scalajs")
)

Expand All @@ -124,7 +124,7 @@ lazy val feed = (project in file("modules/feed"))
.settings(commonSettings: _*)
.settings(dockerSettings("feed"))
.settings(
libraryDependencies += Libraries.scalacheck
libraryDependencies += Libraries.scalacheck.value
)
.dependsOn(core)
.dependsOn(domain.jvm % "compile->compile;compile->test")
Expand Down
27 changes: 0 additions & 27 deletions modules/domain/js/src/main/scala/trading/domain/Symbol.scala

This file was deleted.

13 changes: 7 additions & 6 deletions modules/ws-client/src/main/scala/trading/client/Update.scala
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package trading.client

import trading.client.Model.*
import trading.domain.*
import trading.ws.{ WsIn, WsOut }

import cats.effect.IO
import cats.syntax.all.*

import io.github.iltotore.iron.*
import org.scalajs.dom
import trading.client.Model.*
import trading.domain.*
import trading.ws.{ WsIn, WsOut }
import tyrian.*
import tyrian.cmds.Dom

Expand All @@ -32,7 +31,9 @@ def runUpdates(model: Model): Msg => (Model, Cmd[IO, Msg]) =
model.copy(error = None, sub = None, unsub = None) -> refocusInput

case Msg.SymbolChanged(in) if in.length == 6 =>
model.copy(symbol = Symbol(in), input = in) -> Cmd.None
in.trim.refineEither[SymbolR].map(Symbol(_)).toOption.fold(model -> Cmd.None) { sym =>
model.copy(symbol = sym, input = in) -> Cmd.None
}

case Msg.SymbolChanged(in) =>
model.copy(input = in) -> Cmd.None
Expand Down
14 changes: 7 additions & 7 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object Dependencies {
val redis4cats = "1.4.1"
val refined = "0.10.3"

val scalajsTime = "2.4.0"
val scalajsTime = "2.5.0"
val tyrian = "0.6.1"

val scalacheck = "1.17.0"
Expand Down Expand Up @@ -88,12 +88,12 @@ object Dependencies {
val tyrianIO = Def.setting("io.indigoengine" %%% "tyrian-io" % V.tyrian)

// test
val catsLaws = "org.typelevel" %% "cats-laws" % V.cats
val monocleLaw = "dev.optics" %% "monocle-law" % V.monocle
val scalacheck = "org.scalacheck" %% "scalacheck" % V.scalacheck
val weaverCats = "com.disneystreaming" %% "weaver-cats" % V.weaver
val weaverDiscipline = "com.disneystreaming" %% "weaver-discipline" % V.weaver
val weaverScalaCheck = "com.disneystreaming" %% "weaver-scalacheck" % V.weaver
val catsLaws = Def.setting("org.typelevel" %%% "cats-laws" % V.cats)
val monocleLaw = Def.setting("dev.optics" %%% "monocle-law" % V.monocle)
val scalacheck = Def.setting("org.scalacheck" %%% "scalacheck" % V.scalacheck)
val weaverCats = Def.setting("com.disneystreaming" %%% "weaver-cats" % V.weaver)
val weaverDiscipline = Def.setting("com.disneystreaming" %%% "weaver-discipline" % V.weaver)
val weaverScalaCheck = Def.setting("com.disneystreaming" %%% "weaver-scalacheck" % V.weaver)

// only for demo
val fs2Kafka = "com.github.fd4s" %% "fs2-kafka" % V.fs2Kafka
Expand Down
4 changes: 2 additions & 2 deletions web-app/js/WsPorts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function wsPortsHook(app) {

function keepAlive() {
var timeout = 20000;
if (socket.readyState == socket.OPEN) {
if (socket.readyState === socket.OPEN) {
console.log('[info] Sending heartbeat 💓');
socket.send('{ "Heartbeat": {} }');
}
Expand Down Expand Up @@ -52,7 +52,7 @@ function wsPortsHook(app) {
socket.onerror = function(error) {
console.log(`[error] ${error.message}, ws status: ${socket.readyState}`);

if (socket.readyState == socket.CLOSED) {
if (socket.readyState === socket.CLOSED) {
if ( error != null && error.message != null) {
app.ports.connectionError.send(error.message);
} else {
Expand Down