summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Core/Provider/GlobalMetadata/Tests.hs
blob: 289e2ac81b4cec94faef548b0413da2cfc5188fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
module Hakyll.Core.Provider.GlobalMetadata.Tests
    ( tests
    ) where

--------------------------------------------------------------------------------
import qualified Data.Map                      as M
import           Control.Monad                 (forM_)
import           Test.Framework                (Test, testGroup)
import           Test.HUnit                    (Assertion, (@=?))


--------------------------------------------------------------------------------
import           Hakyll.Core.Provider          (resourceMetadata)
import           TestSuite.Util

--------------------------------------------------------------------------------
tests :: Test
tests = testGroup "Hakyll.Core.Provider.GlobalMetadata.Tests" $
    fromAssertions "page" [testPage]

testPage :: Assertion
testPage = do
    store <- newTestStore
    provider <- newTestProvider store

    metadata <- resourceMetadata provider "posts/2013-10-18-metadata-test.md"
    forM_ ["1", "2", "3", "4", "5", "6", "7", "8"] $ \a ->
        Just a @=? M.lookup ('a':a) metadata