package net.usebox.gemini.server import net.usebox.gemini.server.URIUtils._ import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers class URIUtilsSpec extends AnyFlatSpec with Matchers { behavior of "validPath" it should "return true for the emtpy path" in { "".isValidPath shouldBe true } it should "return true for valid paths" in { List("/", "/file", "/./", "/.", "/dir/", "/dir/../").foreach( _.isValidPath shouldBe true ) } it should "return false for invalid paths" in { List("/../", "/..", "/dir/../..", "/dir/../..", "/./../", "/./dir/.././../") .foreach(_.isValidPath shouldBe false) } }