test(pandoc): add more tests for pandoc helper functions

This commit is contained in:
Steffen Jost 2022-07-14 18:20:57 +02:00
parent 9fa12dc758
commit 8b14cd6c4c

View File

@ -11,17 +11,28 @@ import Text.Pandoc.Arbitrary
spec :: Spec
spec = describe "addMeta" $ do
it "should overwrite existing settings" $ do
metaOverwrite <- arbitrary
pd <- arbitrary
let (Pandoc newMeta _) = addMeta metaOverwrite pd
Map.toList newMeta `shouldContain` Map.toList metaOverwrite
spec = do
describe "addMeta" $ do
it "should overwrite existing settings" $ do
metaOverwrite <- arbitrary
pd <- arbitrary
let (Pandoc newMeta _) = addMeta metaOverwrite pd
Map.toList newMeta `shouldContain` Map.toList metaOverwrite
it "should preserve untouched settings" $ do
metaOverwrite <- arbitrary
pd <- arbitrary
let
(Pandoc keptMeta _) = pd
(Pandoc newMeta _) = addMeta metaOverwrite pd
Map.toList newMeta `shouldContain` Map.toList (keptMeta `Map.difference` metaOverwrite)
it "should preserve untouched settings" $ do
metaOverwrite <- arbitrary
pd <- arbitrary
let
(Pandoc keptMeta _) = pd
(Pandoc newMeta _) = addMeta metaOverwrite pd
Map.toList newMeta `shouldContain` Map.toList (keptMeta `Map.difference` metaOverwrite)
it "should preserve document block" $ do
metaOverwrite <- arbitrary
pd <- arbitrary
let
(Pandoc _ oldBlocks) = pd
(Pandoc - newBlocks) = addMeta metaOverwrite pd
oldBlocks `shouldBe` newBlocks
describe "_Meta" . it "is a lens" . property $ isLens _Meta