Skip to content

Commit b9ea605

Browse files
committed
Fix tests
1 parent 531f4af commit b9ea605

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ jobs:
1818

1919
- name: Build and test
2020
shell: bash
21-
run: sbt test
21+
run: |
22+
npm install jsdom
23+
sbt test

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ lazy val editor = (project in file("editor"))
3131
name := "flowrun-editor",
3232
libraryDependencies ++= Seq(
3333
"com.lihaoyi" %%% "scalatags" % "0.13.1",
34-
"com.lihaoyi" %%% "utest" % "0.8.5" % Test
34+
"com.lihaoyi" %%% "utest" % "0.9.1" % Test
3535
),
3636
scalacOptions ++= Seq(
3737
"-Xmax-inlines",
@@ -57,7 +57,7 @@ lazy val interpreter = crossProject(JVMPlatform, JSPlatform)
5757
"io.github.cquiroz" %%% "scala-java-time" % "2.6.0",
5858
"com.outr" %%% "reactify" % "4.1.3",
5959
"ba.sake" %%% "tupson" % "0.18.0",
60-
"com.lihaoyi" %%% "utest" % "0.8.5" % Test
60+
"com.lihaoyi" %%% "utest" % "0.9.1" % Test
6161
),
6262
scalacOptions ++= Seq(
6363
"-Xmax-inlines",

editor/src/main/scala/dev/sacode/flowrun/FlowRunEditor.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,6 @@ class FlowRunEditor(
519519
codeArea.render(id)
520520

521521
private def doOnModelChange(): Unit =
522-
programModel.incrRevision()
523522
Option(changeCallback).foreach(cb => cb(this))
524523

525524
private def setLayout(): Unit = {

interpreter/shared/src/main/scala/dev/sacode/flowrun/ProgramModel.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ class ProgramModel(
1515
var currentSelectedFunctionId: String = MainFunId
1616
var currentSelectedStmtId: Option[String] = None
1717

18-
def incrRevision(): Unit =
18+
private def incrRevision(): Unit =
1919
ast = ast.copy(revision = ast.revision + 1)
2020

2121
def setName(name: String): Unit =
2222
ast = ast.copy(name = name)
23+
incrRevision()
2324
flowrunChannel := FlowRun.Event.FunctionUpdated
2425

2526
def setConfig(config: FlowRunConfig): Unit =
2627
ast = ast.copy(config = config)
28+
incrRevision()
2729
flowrunChannel := FlowRun.Event.ConfigChanged
2830

2931
def currentFunction: Function =
@@ -34,6 +36,7 @@ class ProgramModel(
3436
val newFunctions = ast.functions.appended(fun)
3537
ast = ast.copy(functions = newFunctions)
3638
currentSelectedFunctionId = fun.id
39+
incrRevision()
3740
flowrunChannel := FlowRun.Event.Deselected
3841
flowrunChannel := FlowRun.Event.FunctionUpdated
3942

@@ -55,6 +58,7 @@ class ProgramModel(
5558
val newFunctions = ast.functions.filterNot(_.id == id)
5659
ast = ast.copy(functions = newFunctions)
5760
currentSelectedFunctionId = MainFunId
61+
incrRevision()
5862
flowrunChannel := FlowRun.Event.Deselected
5963
flowrunChannel := FlowRun.Event.FunctionUpdated
6064

@@ -76,6 +80,7 @@ class ProgramModel(
7680
else f
7781
}
7882
ast = ast.copy(functions = newFunctions)
83+
incrRevision()
7984
flowrunChannel := FlowRun.Event.FunctionUpdated
8085

8186
/* per-function */
@@ -102,7 +107,7 @@ class ProgramModel(
102107
val newFunctions = ast.functions.updated(idx, newFunction)
103108
ast = ast.copy(functions = newFunctions)
104109
}
105-
110+
incrRevision()
106111
flowrunChannel := evt
107112
}
108113
}

interpreter/shared/src/test/scala/dev/sacode/flowrun/eval/InterpreterTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ object InterpreterTests extends TestSuite {
4646
val scope = interpreter.symTab.globalScope.childScopes.head
4747
assert(!scope.isDeclaredVar("nope"))
4848
assert(scope.isDeclaredVar("empty"))
49-
intercept[EvalException](scope.getValue("", "nope"))
50-
intercept[EvalException](scope.getValue("", "empty"))
49+
assertThrows[EvalException](scope.getValue("", "nope"))
50+
assertThrows[EvalException](scope.getValue("", "empty"))
5151
}
5252
}
5353

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"dependencies": {
3-
"jsdom": "^21.1.0"
3+
"jsdom": "^21.1.2"
44
}
55
}

0 commit comments

Comments
 (0)