Skip to content

Commit ea00079

Browse files
committed
Apply scalafmt on test
1 parent fdec493 commit ea00079

File tree

3 files changed

+30
-33
lines changed

3 files changed

+30
-33
lines changed

src/test/scala/fr/janalyse/cem/SynchronizeSpec.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ object SynchronizeSpec extends DefaultRunnableSpec {
2424
// ----------------------------------------------------------------------------------------------
2525
val t1 = testM("check examples coherency success with valid examples") {
2626
val examplesWithIssues = List(
27-
CodeExample(filename="pi-1.sc", content="42", uuid=Some("e7f1879c-c893-4b3d-bac1-f11f641e90bd")),
28-
CodeExample(filename="pi-2.sc", content="42", uuid=Some("a49b0c53-3ec3-4404-bd7d-c249a4868a2b")),
27+
CodeExample(filename = "pi-1.sc", content = "42", uuid = Some("e7f1879c-c893-4b3d-bac1-f11f641e90bd")),
28+
CodeExample(filename = "pi-2.sc", content = "42", uuid = Some("a49b0c53-3ec3-4404-bd7d-c249a4868a2b"))
2929
)
3030
assertM(Synchronize.examplesCheckCoherency(examplesWithIssues).run)(succeeds(anything))
3131
}
3232
// ----------------------------------------------------------------------------------------------
3333
val t2 = testM("check examples coherency should fail on duplicates UUID") {
3434
val examplesWithIssues = List(
35-
CodeExample(filename="pi-1.sc", content="42", uuid=Some("e7f1879c-c893-4b3d-bac1-f11f641e90bd")),
36-
CodeExample(filename="pi-2.sc", content="42", uuid=Some("e7f1879c-c893-4b3d-bac1-f11f641e90bd")),
35+
CodeExample(filename = "pi-1.sc", content = "42", uuid = Some("e7f1879c-c893-4b3d-bac1-f11f641e90bd")),
36+
CodeExample(filename = "pi-2.sc", content = "42", uuid = Some("e7f1879c-c893-4b3d-bac1-f11f641e90bd"))
3737
)
3838
assertM(Synchronize.examplesCheckCoherency(examplesWithIssues).run)(fails(hasMessage(containsString("duplicated UUIDs"))))
3939
}
4040

4141
// ----------------------------------------------------------------------------------------------
4242
override def spec = {
43-
suite("CodeExample tests")(t1,t2)
43+
suite("CodeExample tests")(t1, t2)
4444
}
45-
}
45+
}

src/test/scala/fr/janalyse/cem/model/CodeExampleSpec.scala

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import zio.test.*
2121

2222
object CodeExampleSpec extends DefaultRunnableSpec {
2323

24-
val exampleFakeTestingFilename = "test-data/sample1/fake-testing-pi.sc"
24+
val exampleFakeTestingFilename = "test-data/sample1/fake-testing-pi.sc"
2525
val exampleFakeTestingSearchRoot = "test-data/sample1"
26-
val exampleFakeTestingPiContent =
26+
val exampleFakeTestingPiContent =
2727
"""// summary : Simplest scalatest test framework usage.
2828
|// keywords : scalatest, pi, @testable
2929
|// publish : gist, snippet
@@ -41,32 +41,33 @@ object CodeExampleSpec extends DefaultRunnableSpec {
4141
val t1 = testM("make an example") {
4242
for {
4343
example <- CodeExample.makeExample(exampleFakeTestingFilename, exampleFakeTestingSearchRoot, Task(exampleFakeTestingPiContent))
44-
} yield
45-
assert(example.filename)(equalTo("fake-testing-pi.sc")) &&
46-
assert(example.category)(equalTo(None)) &&
47-
assert(example.summary)(equalTo(Some("Simplest scalatest test framework usage."))) &&
48-
assert(example.fileExt)(equalTo("sc")) &&
49-
assert(example.publish)(equalTo(List("gist", "snippet"))) &&
50-
assert(example.authors)(equalTo(List("David Crosson"))) &&
51-
assert(example.keywords)(equalTo(List("scalatest", "pi", "@testable"))) &&
52-
assert(example.uuid)(equalTo(Some("8f2e14ba-9856-4500-80ab-3b9ba2234ce2"))) &&
53-
assert(example.content)(matchesRegex("(?s).*id [:] 8f2e14ba-9856-4500-80ab-3b9ba2234ce2.*")) &&
54-
assert(example.checksum)(equalTo("5f6dd8a2d2f813ee946542161503d61cb9a8074e"))
44+
} yield assert(example.filename)(equalTo("fake-testing-pi.sc")) &&
45+
assert(example.category)(equalTo(None)) &&
46+
assert(example.summary)(equalTo(Some("Simplest scalatest test framework usage."))) &&
47+
assert(example.fileExt)(equalTo("sc")) &&
48+
assert(example.publish)(equalTo(List("gist", "snippet"))) &&
49+
assert(example.authors)(equalTo(List("David Crosson"))) &&
50+
assert(example.keywords)(equalTo(List("scalatest", "pi", "@testable"))) &&
51+
assert(example.uuid)(equalTo(Some("8f2e14ba-9856-4500-80ab-3b9ba2234ce2"))) &&
52+
assert(example.content)(matchesRegex("(?s).*id [:] 8f2e14ba-9856-4500-80ab-3b9ba2234ce2.*")) &&
53+
assert(example.checksum)(equalTo("5f6dd8a2d2f813ee946542161503d61cb9a8074e"))
5554
}
5655

5756
// ----------------------------------------------------------------------------------------------
5857
val t2 = test("automatically recognize categories from sub-directory name") {
5958
val inputsAndExpectedResults: List[((String, String), Option[String])] = List(
60-
("test-data/fake-testing-pi.sc", "test-data/") -> None,
61-
("test-data/fake-testing-pi.sc", "") -> Some("test-data"),
59+
("test-data/fake-testing-pi.sc", "test-data/") -> None,
60+
("test-data/fake-testing-pi.sc", "") -> Some("test-data"),
6261
("test-data/sample1/fake-testing-pi.sc", "test-data/sample1") -> None,
63-
("test-data/sample1/fake-testing-pi.sc", "test-data") -> Some("sample1"),
64-
("test-data/sample1/fake-testing-pi.sc", "test-data/") -> Some("sample1"),
65-
("test-data/sample1/fake-testing-pi.sc", "") -> Some("test-data/sample1")
62+
("test-data/sample1/fake-testing-pi.sc", "test-data") -> Some("sample1"),
63+
("test-data/sample1/fake-testing-pi.sc", "test-data/") -> Some("sample1"),
64+
("test-data/sample1/fake-testing-pi.sc", "") -> Some("test-data/sample1")
6665
)
67-
inputsAndExpectedResults.map { case ((filename, searchRoot), expectedResult) =>
68-
assert(CodeExample.exampleCategoryFromFilepath(filename, searchRoot))(equalTo(expectedResult))
69-
}.reduce(_ && _)
66+
inputsAndExpectedResults
67+
.map { case ((filename, searchRoot), expectedResult) =>
68+
assert(CodeExample.exampleCategoryFromFilepath(filename, searchRoot))(equalTo(expectedResult))
69+
}
70+
.reduce(_ && _)
7071
}
7172

7273
// ----------------------------------------------------------------------------------------------

src/test/scala/fr/janalyse/cem/tools/DescriptionToolsSpec.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,12 @@ import fr.janalyse.cem.tools.DescriptionTools.*
2020
import zio.test.Assertion.*
2121
import zio.test.*
2222

23-
2423
object DescriptionToolsSpec extends DefaultRunnableSpec {
2524

26-
2725
// ----------------------------------------------------------------------------------------------
2826
val t1 = test("extractMetaDataFromDescription can return example uuid and checksum from the description") {
2927
val description = "Blah example / published by https://github.com/dacr/code-examples-manager #7135b214-5b48-47d0-afd7-c7f64c0a31c3/5ec6b73c57561e0cc578dea654eeddce09433252"
30-
assert(extractMetaDataFromDescription(description))(
31-
equalTo(Some("7135b214-5b48-47d0-afd7-c7f64c0a31c3"->"5ec6b73c57561e0cc578dea654eeddce09433252")
32-
))
28+
assert(extractMetaDataFromDescription(description))(equalTo(Some("7135b214-5b48-47d0-afd7-c7f64c0a31c3" -> "5ec6b73c57561e0cc578dea654eeddce09433252")))
3329
}
3430

3531
// ----------------------------------------------------------------------------------------------
@@ -40,7 +36,7 @@ object DescriptionToolsSpec extends DefaultRunnableSpec {
4036

4137
// ----------------------------------------------------------------------------------------------
4238
val t3 = test("makeDescription should return a description for ready to publish code examples") {
43-
assert(makeDescription(CodeExample(filename="truc.sc", uuid = Some("aaaa"), content="blah"))) (
39+
assert(makeDescription(CodeExample(filename = "truc.sc", uuid = Some("aaaa"), content = "blah")))(
4440
isSome(
4541
endsWithString("#aaaa/")
4642
)

0 commit comments

Comments
 (0)