package net.usebox.gemini.server import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers import URIUtils._ 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) } }