Support text based placeholders
All checks were successful
Build / audit (push) Successful in 9s
Build / test (push) Successful in 14m17s

This commit is contained in:
2024-09-01 17:34:24 +02:00
parent 14cc805dcf
commit 4f74c2ec10
3 changed files with 21 additions and 80 deletions

View File

@ -6,7 +6,6 @@ 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)
@ -15,17 +14,13 @@ spec :: Spec
spec = do
describe "renderDownloadWithVersion" $ do
it "renders text as URL" $
let given = DownloadTemplate
$ pure
$ StaticPlaceholder "https://example.com"
let given = DownloadTemplate "https://example.com"
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"]
let given = DownloadTemplate "https://example.com/{version}/segment"
actual = renderDownloadWithVersion given "1.2"
expected = Just [uri|https://example.com/1.2/segment|]
in actual `shouldBe` expected