aboutsummaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2021-02-26 10:45:00 +0000
committerJuan J. Martinez <jjm@usebox.net>2021-07-22 19:49:48 +0100
commitb2d82bddd39d61c81ce14086809d817a1475e0b5 (patch)
tree0a0e233a2f134abd2da44eece02fc16ffd382dd7 /server/test
parent2149d073ddb557ad70d2aa0a86289653530e5986 (diff)
downloadspacebeans-b2d82bddd39d61c81ce14086809d817a1475e0b5.tar.gz
spacebeans-b2d82bddd39d61c81ce14086809d817a1475e0b5.zip
Support for JDK 8 (and 11)
Diffstat (limited to 'server/test')
-rw-r--r--server/test/src/ServerSpec.scala34
1 files changed, 23 insertions, 11 deletions
diff --git a/server/test/src/ServerSpec.scala b/server/test/src/ServerSpec.scala
index 40a2818..d086d2d 100644
--- a/server/test/src/ServerSpec.scala
+++ b/server/test/src/ServerSpec.scala
@@ -1,6 +1,6 @@
package net.usebox.gemini.server
-import java.nio.file.Path
+import java.nio.file.FileSystems
import scala.concurrent.duration._
@@ -33,33 +33,42 @@ class ServerSpec extends AnyFlatSpec with Matchers {
it should "resolve a known MIME type" in {
Server(TestData.conf)
- .guessMimeType(Path.of("file.html"), None) shouldBe "text/html"
+ .guessMimeType(
+ FileSystems.getDefault().getPath("file.html"),
+ None
+ ) shouldBe "text/html"
}
it should "resolve de default MIME type for unknown types" in {
Server(TestData.conf)
.guessMimeType(
- Path.of("unknow"),
+ FileSystems.getDefault().getPath("unknow"),
None
) shouldBe TestData.conf.defaultMimeType
}
it should "resolve gemini MIME type" in {
Server(TestData.conf)
- .guessMimeType(Path.of("file.gmi"), None) shouldBe "text/gemini"
+ .guessMimeType(
+ FileSystems.getDefault().getPath("file.gmi"),
+ None
+ ) shouldBe "text/gemini"
Server(TestData.conf)
- .guessMimeType(Path.of("file.gemini"), None) shouldBe "text/gemini"
+ .guessMimeType(
+ FileSystems.getDefault().getPath("file.gemini"),
+ None
+ ) shouldBe "text/gemini"
}
it should "resolve gemini MIME type, including parameters" in {
Server(TestData.conf)
.guessMimeType(
- Path.of("file.gmi"),
+ FileSystems.getDefault().getPath("file.gmi"),
Some("param")
) shouldBe "text/gemini; param"
Server(TestData.conf)
.guessMimeType(
- Path.of("file.gemini"),
+ FileSystems.getDefault().getPath("file.gemini"),
Some("param")
) shouldBe "text/gemini; param"
}
@@ -67,7 +76,7 @@ class ServerSpec extends AnyFlatSpec with Matchers {
it should "gemini MIME type parameters are sanitized" in {
Server(TestData.conf)
.guessMimeType(
- Path.of("file.gmi"),
+ FileSystems.getDefault().getPath("file.gmi"),
Some(" ; param")
) shouldBe "text/gemini; param"
}
@@ -76,14 +85,17 @@ class ServerSpec extends AnyFlatSpec with Matchers {
it should "resolve a known MIME type" in {
Server(TestData.conf.copy(mimeTypes = TestData.mimeTypes))
- .guessMimeType(Path.of("file.gmi"), None) shouldBe "config"
+ .guessMimeType(
+ FileSystems.getDefault().getPath("file.gmi"),
+ None
+ ) shouldBe "config"
}
it should "include parameters for text/gemini MIME types" in {
Server(
TestData.conf.copy(mimeTypes = Some(Map("text/gemini" -> List(".gmi"))))
).guessMimeType(
- Path.of("file.gmi"),
+ FileSystems.getDefault().getPath("file.gmi"),
Some("param")
) shouldBe "text/gemini; param"
}
@@ -91,7 +103,7 @@ class ServerSpec extends AnyFlatSpec with Matchers {
it should "resolve de default MIME type for unknown types" in {
Server(TestData.conf.copy(mimeTypes = TestData.mimeTypes))
.guessMimeType(
- Path.of("unknow"),
+ FileSystems.getDefault().getPath("unknow"),
None
) shouldBe TestData.conf.defaultMimeType
}