Skip to content

Commit a0f7a62

Browse files
committed
style: improve test style (\n after each test)
1 parent 5d5638b commit a0f7a62

File tree

7 files changed

+21
-3
lines changed

7 files changed

+21
-3
lines changed

scafi-web/src/test/scala/it/unibo/scafi/js/WebIncarnationTest.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class WebIncarnationTest extends AnyFunSpec with Matchers with NetworkSupport {
3030
.get
3131
updatedResult.root[Int]() shouldBe (result.root[Int]() + 1)
3232
}
33+
3334
it("should support nbr and foldhood construct") {
3435
val middleElement = "5"
3536
val neighbours = 5 //at the end, the middle node tend to have four neighbours plus itself
@@ -41,6 +42,7 @@ class WebIncarnationTest extends AnyFunSpec with Matchers with NetworkSupport {
4142
.exists { case (_, value) => value.root[Int]() == neighbours}
4243
assert(neighboursResult)
4344
}
45+
4446
it("should support mid construct") {
4547
val nodes = webEngine.ids
4648
val program = new WebIncarnation.AggregateProgram {
@@ -52,6 +54,7 @@ class WebIncarnationTest extends AnyFunSpec with Matchers with NetworkSupport {
5254
.toSet
5355
nodes shouldBe mids
5456
}
57+
5558
it("should support sense construct") {
5659
val sensorName = "source"
5760
webEngine.addSensor(sensorName, false)
@@ -67,6 +70,7 @@ class WebIncarnationTest extends AnyFunSpec with Matchers with NetworkSupport {
6770
assert(sensorValues.contains("1" -> false))
6871
assert(sensorValues.contains("5" -> true))
6972
}
73+
7074
it("should support mux construct") {
7175
val sensorName = "source"
7276
webEngine.addSensor(sensorName, false)

scafi-web/src/test/scala/it/unibo/scafi/js/controller/local/SimulationCommandInterpreterTest.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class SimulationCommandInterpreterTest extends SupportTesterLike {
1313
newGraph.map(graph => (graph(node).position.x, graph(node).position.y))
1414
.map(newPosition => newPosition shouldBe position)
1515
}
16+
1617
it("able to eval change command adding new sensor") {
1718
val node = "1"
1819
val sensor = "new"

scafi-web/src/test/scala/it/unibo/scafi/js/controller/local/SimulationExecutionTest.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class SimulationExecutionTest extends SupportTesterLike {
7272
}
7373
}
7474
}
75+
7576
it("daemon delta change frequency") {
7677
val execution = localPlatform.loadScript(Script.javascript("rep(() => 0, x => x + 1)"))
7778
val delta = 50
@@ -142,4 +143,4 @@ object SimulationExecutionTest {
142143
scalajs.js.timers.setTimeout(time)(promise.success({}))
143144
promise.future
144145
}
145-
}
146+
}

scafi-web/src/test/scala/it/unibo/scafi/js/dsl/JavascriptDslTest.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class JavascriptDslTest extends AnyFunSpec with Matchers with NetworkSupport {
2424
val (_, jsExport) = webEngine.exec(dsl.adaptForScafi(jsProgram))
2525
jsExport.root[Int]() shouldBe scalaExport.root[Int]()
2626
}
27+
2728
it("has rep construct") {
2829
val program = dsl.adaptForScafi(rawToFunction("rep(() => 0, x => x + 1)"))
2930
val executions = 100
@@ -34,11 +35,13 @@ class JavascriptDslTest extends AnyFunSpec with Matchers with NetworkSupport {
3435
.toList
3536
executionOnOne shouldBe (1 to executionOnOne.size).toList
3637
}
38+
3739
it("has mid construct") {
3840
val program = dsl.adaptForScafi(rawToFunction("mid()"))
3941
val (id, export) = webEngine.exec(program)
4042
id shouldBe export.root[ID]()
4143
}
44+
4245
it("has nbr and foldhood construct") {
4346
val program = rawToFunction("foldhood(() => 0, (x, y) => x + y, () => nbr(() => 1))")
4447
val iterations = 100
@@ -49,6 +52,7 @@ class JavascriptDslTest extends AnyFunSpec with Matchers with NetworkSupport {
4952
assert(foldResults.contains("2" -> 4))
5053
assert(foldResults.contains("5" -> 5))
5154
}
55+
5256
it("has sense construct") {
5357
val sensor = "source"
5458
webEngine.addSensor(sensor, false)
@@ -61,6 +65,7 @@ class JavascriptDslTest extends AnyFunSpec with Matchers with NetworkSupport {
6165
sensors.contains("1" -> false)
6266
sensors.contains("5" -> true)
6367
}
68+
6469
it("has aggregate construct") {
6570
val program = dsl.adaptForScafi(rawToFunction(s"aggregate(() => 10)"))
6671
val (_, export) = webEngine.exec(program)

scafi-web/src/test/scala/it/unibo/scafi/js/model/NaiveGraphTest.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class NaiveGraphTest extends AnyFunSpec with Matchers {
1515
nodes shouldBe graph.nodes
1616
vertices shouldBe graph.vertices
1717
}
18+
1819
it("has correct neighbours") {
1920
val nodes = Set(node("1"), node("2"), node("3"))
2021
val vertices = Set(Vertex("1", "2"), Vertex("1", "3"))
@@ -36,12 +37,15 @@ class NaiveGraphTest extends AnyFunSpec with Matchers {
3637
it("apply works as expected ") {
3738
standardGraph("1") shouldBe node("1")
3839
}
40+
3941
it("apply throws exception if the id isn't present") {
4042
assertThrows[NoSuchElementException]{standardGraph("bibo")}
4143
}
44+
4245
it("get return node if the node is present") {
4346
standardGraph.get("1") shouldBe Some(node("1"))
4447
}
48+
4549
it("get return None if the node isn't present") {
4650
standardGraph.get("bibo") shouldBe None
4751
}

scafi-web/src/test/scala/it/unibo/scafi/js/package.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@ package object js {
77
@JSImport("canvas", JSImport.Namespace)
88
object Canvas extends jsLib.Object
99
Canvas
10-
11-
1210
}

scafi-web/src/test/scala/it/unibo/scafi/js/util/CookieTest.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,29 @@ class CookieTest extends AsyncFunSpec with Matchers {
2121
assert(Cookie.has(entry))
2222
assert(Cookie.get(entry).contains(data))
2323
}
24+
2425
it("should be removed from the page") {
2526
Cookie.store(entry, data)
2627
Cookie.remove(entry)
2728
assert(!Cookie.has(entry))
2829
assert(Cookie.get(entry).isEmpty)
2930
}
31+
3032
it("should returns only stored cookie") {
3133
Cookie.has(emptyEntry) shouldBe false
3234
}
35+
3336
it("should be able to remove all cookies") {
3437
Cookie.clear()
3538
Cookie.all() shouldBe Map.empty
3639
}
40+
3741
it("should returns all cookie in a map representation") {
3842
val cookies = Map("key1" -> "value1", "key2" -> "value2")
3943
cookies.foreach { case (k, d) => Cookie.store(k, d)}
4044
assert(Cookie.all() == cookies)
4145
}
46+
4247
it("should store cookie with temporal limit") {
4348
Cookie.storeWithTemporalLimit(entry, data, duration)
4449
assert(Cookie.has(entry))

0 commit comments

Comments
 (0)