Fix renderDownloadWithVersion concatenation order

This commit is contained in:
2023-09-22 07:47:46 +02:00
parent 840290491f
commit ec704e267b
3 changed files with 18 additions and 4 deletions

View File

@ -2,13 +2,14 @@ module SlackBuilder.PackageSpec
( spec
) where
import Data.List.NonEmpty (NonEmpty(..))
import SlackBuilder.Package
import Test.Hspec (Spec, describe, it, shouldBe)
import Text.URI.QQ (uri)
spec :: Spec
spec = do
describe "renderDownloadWithVersion" $
describe "renderDownloadWithVersion" $ do
it "renders text as URL" $
let given = DownloadTemplate
$ pure
@ -16,3 +17,11 @@ spec = do
actual = renderDownloadWithVersion given "1.2"
expected = Just [uri|https://example.com|]
in actual `shouldBe` expected
it "renders the components in order" $
let given = DownloadTemplate
$ StaticPlaceholder "https://example.com/"
:| [VersionPlaceholder, StaticPlaceholder "/segment"]
actual = renderDownloadWithVersion given "1.2"
expected = Just [uri|https://example.com/1.2/segment|]
in actual `shouldBe` expected