Skip to content

Commit 44dcdcf

Browse files
committed
style(analysis, domain, parser, api, state): improve consistency in naming conventions for test descriptions and messages
1 parent 9b12730 commit 44dcdcf

7 files changed

Lines changed: 40 additions & 40 deletions

File tree

analysis/src/test/scala/analysis/DependencySpec.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ class DependencySpec extends FunSuite:
3030

3131
noDependTest(
3232
testName =
33-
"Domain package should only depend on itself and standard libraries",
33+
"domain package should only depend on itself and standard libraries",
3434
importRoot = "domain..",
3535
packageToCheck = "..domain..",
3636
forbiddenPackages = Seq("..laminar..", "..state..", "..js.."),
3737
becauseMsg =
38-
"Domain layer should be isolated from infrastructure and application layers"
38+
"domain layer should be isolated from infrastructure and application layers"
3939
)
4040

4141
noDependTest(
42-
testName = "State package should only depend on itself and Laminar",
42+
testName = "state package should only depend on itself and Laminar",
4343
importRoot = "state..",
4444
packageToCheck = "..state..",
4545
forbiddenPackages = Seq("..view..", "..API.."),
4646
becauseMsg =
47-
"State layer should be isolated from infrastructure and application layers"
47+
"state layer should be isolated from infrastructure and application layers"
4848
)

analysis/src/test/scala/domain/DomainSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import munit.ScalaCheckSuite
88
import org.scalacheck.Prop.forAll
99

1010
class DomainSpec extends FunSuite with ScalaCheckSuite:
11-
test("Edge from x to y is the same of y to x") {
11+
test("edge from x to y is the same of y to x") {
1212
forAll {
1313
(
1414
id1: Int,
@@ -32,7 +32,7 @@ class DomainSpec extends FunSuite with ScalaCheckSuite:
3232
}
3333
}
3434

35-
test("Edges with different nodes is not equal") {
35+
test("edges with different nodes is not equal") {
3636
forAll {
3737
(
3838
id1: Int,

analysis/src/test/scala/parser/EdgeParserSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ class EdgeParserSpec extends FunSuite with ScalaCheckSuite:
1717
"target": $target
1818
}]"""
1919

20-
test("EdgeParser parses valid single edge JSON") {
20+
test("parses valid single edge JSON") {
2121
forAll(validEdgeJsonGen) { jsonString =>
2222
EdgeParser.parse(jsonString).fold(false) { edges =>
2323
edges.size == 1
2424
}
2525
}
2626
}
2727

28-
test("EdgeParser handles invalid JSON") {
28+
test("if JSON is invalid, no edges are parsed without exceptions") {
2929
forAll(Gen.numStr) { invalidJson =>
3030
EdgeParser.parse(invalidJson).isEmpty
3131
}

analysis/src/test/scala/parser/NodeParserSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class NodeParserSpec extends FunSuite with ScalaCheckSuite:
3333
GraphNode(id, Position(x, y, z), label, color)
3434
)
3535

36-
test("NodeParser parses valid single node JSON") {
36+
test("parses valid single node JSON") {
3737
forAll(validNodeJsonGen) {
3838
case (jsonString, validJsonNodeFromParams) =>
3939
NodeParser.parse(jsonString).fold(false) { nodes =>
@@ -42,7 +42,7 @@ class NodeParserSpec extends FunSuite with ScalaCheckSuite:
4242
}
4343
}
4444

45-
test("NodeParser handles invalid JSON") {
45+
test("if JSON is invalid, no nodes are parsed without exceptions") {
4646
forAll(Gen.numStr) { invalidJson =>
4747
NodeParser.parse(invalidJson).isEmpty
4848
}

js/src/test/scala/api/ApiSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ApiSpec extends FunSuite with ScalaCheckSuite:
4242
"target": $target
4343
}]"""
4444

45-
test("Add nodes from JSON") {
45+
test("add nodes from JSON") {
4646
forAll(validNodeJsonGen) {
4747
case (jsonString, validJsonNodeFromParams) =>
4848
GraphAPI.addNodesFromJson(
@@ -51,7 +51,7 @@ class ApiSpec extends FunSuite with ScalaCheckSuite:
5151
}
5252
}
5353

54-
test("Add edges from JSON") {
54+
test("add edges from JSON") {
5555
forAll(validEdgeJsonGen) { jsonString =>
5656
GraphAPI.addEdgesFromJson(
5757
jsonString

js/src/test/scala/state/AnimationStateSpec.scala

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,73 +25,73 @@ class AnimationStateSpec extends FunSuite with ScalaCheckSuite:
2525

2626
test("initial state validates default values") {
2727
Prop.all(
28-
Prop(AnimationState.batch.now() == 1),
29-
Prop(AnimationState.currentTick.now() == 0),
30-
Prop(AnimationState.engine.now().isEmpty),
31-
Prop(AnimationState.mode.now() == ViewMode.Mode3D)
28+
AnimationState.batch.now() == 1,
29+
AnimationState.currentTick.now() == 0,
30+
AnimationState.engine.now().isEmpty,
31+
AnimationState.mode.now() == ViewMode.Mode3D
3232
)
3333
}
3434

35-
test("SetEngine updates engine and resets state") {
35+
test("updates engine and resets state") {
3636
forAll(Gen.const(js.Dynamic.literal())) { mockEngine =>
3737
AnimationState.animationObserver.onNext(SetEngine(mockEngine))
3838
Prop.all(
39-
Prop(AnimationState.engine.now().contains(mockEngine)),
40-
Prop(!AnimationState.running.now()),
41-
Prop(AnimationState.currentTick.now() == 0)
39+
AnimationState.engine.now().contains(mockEngine),
40+
!AnimationState.running.now(),
41+
AnimationState.currentTick.now() == 0
4242
)
4343
}
4444
}
4545

46-
test("StartAnimation manages running state") {
46+
test("start animation") {
4747

4848
AnimationState.animationObserver.onNext(StartAnimation())
49-
Prop(AnimationState.running.now())
49+
AnimationState.running.now()
5050

5151
}
5252

53-
test("PauseAnimation stops animation") {
53+
test("stops animation") {
5454

5555
AnimationState.animationObserver.onNext(StartAnimation())
5656
AnimationState.animationObserver.onNext(PauseAnimation())
57-
Prop(!AnimationState.running.now())
57+
!AnimationState.running.now()
5858

5959
}
6060

61-
test("NextTick increments current tick") {
61+
test("increments current tick") {
6262

6363
val initialTick = AnimationState.currentTick.now()
6464
AnimationState.animationObserver.onNext(NextTick())
65-
Prop(AnimationState.currentTick.now() == initialTick + 1)
65+
AnimationState.currentTick.now() == initialTick + 1
6666

6767
}
6868

69-
test("AnimationBatch updates batch value") {
69+
test("updates batch value") {
7070
forAll(Gen.choose(1, 10)) { batchValue =>
7171
AnimationState.animationObserver.onNext(AnimationBatch(batchValue))
72-
Prop(AnimationState.batch.now() == batchValue)
72+
AnimationState.batch.now() == batchValue
7373
}
7474
}
7575

76-
test("Reset restores initial state") {
76+
test("restores initial state") {
7777

7878
AnimationState.animationObserver.onNext(StartAnimation())
7979
AnimationState.animationObserver.onNext(NextTick())
8080
AnimationState.animationObserver.onNext(Reset())
8181
Prop.all(
82-
Prop(!AnimationState.running.now()),
83-
Prop(AnimationState.currentTick.now() == 0)
82+
!AnimationState.running.now(),
83+
AnimationState.currentTick.now() == 0
8484
)
8585

8686
}
8787

88-
test("SwitchMode toggles between view modes") {
88+
test("Switch mode between view modes") {
8989

9090
val initialMode = AnimationState.mode.now()
9191
AnimationState.animationObserver.onNext(SwitchMode())
92-
Prop(
93-
AnimationState.mode.now() ==
94-
(if initialMode == ViewMode.Mode3D then ViewMode.Mode2D
95-
else ViewMode.Mode3D)
96-
)
92+
93+
AnimationState.mode.now() ==
94+
(if initialMode == ViewMode.Mode3D then ViewMode.Mode2D
95+
else ViewMode.Mode3D)
96+
9797
}

js/src/test/scala/state/GraphStateSpec.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GraphStateSpec extends FunSuite with ScalaCheckSuite:
1616
GraphState.commandObserver.onNext(SetNodes(Set.empty))
1717
GraphState.commandObserver.onNext(SetEdges(Set.empty))
1818

19-
test("addNode should add a node to the state") {
19+
test("add a node to the state") {
2020
forAll {
2121
(id: Int, label: String, color: Int, x: Double, y: Double, z: Double) =>
2222
val node: Set[GraphNode] =
@@ -27,7 +27,7 @@ class GraphStateSpec extends FunSuite with ScalaCheckSuite:
2727
}
2828
}
2929

30-
test("addEdge should add an edge to the state") {
30+
test("add an edge to the state") {
3131
forAll {
3232
(
3333
id1: Int,
@@ -56,7 +56,7 @@ class GraphStateSpec extends FunSuite with ScalaCheckSuite:
5656
}
5757
}
5858

59-
test("addEdgeById should add an edge to the state") {
59+
test("add an edge to the state by nodes' ids") {
6060
forAll {
6161
(
6262
id1: Int,

0 commit comments

Comments
 (0)