diff options
author | David Parrish <daveparrish@tutanota.com> | 2019-08-25 09:02:01 -0400 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2019-08-25 15:02:01 +0200 |
commit | 779fa66c7b1719e071dc3f4d38a4cc2feb9492c6 (patch) | |
tree | c8a5155c5671f544c1c7eb4bf1a5e85e0ad17ad0 /tests/Hakyll/Web/Tags | |
parent | e8ea8cd57bc627e58b3fc14f23f11d310044dc33 (diff) | |
download | hakyll-779fa66c7b1719e071dc3f4d38a4cc2feb9492c6.tar.gz |
Add getCategory tests
Diffstat (limited to 'tests/Hakyll/Web/Tags')
-rw-r--r-- | tests/Hakyll/Web/Tags/Tests.hs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/Hakyll/Web/Tags/Tests.hs b/tests/Hakyll/Web/Tags/Tests.hs new file mode 100644 index 0000000..9b225e1 --- /dev/null +++ b/tests/Hakyll/Web/Tags/Tests.hs @@ -0,0 +1,42 @@ +-------------------------------------------------------------------------------- +{-# LANGUAGE OverloadedStrings #-} +module Hakyll.Web.Tags.Tests + ( tests + ) where + +-------------------------------------------------------------------------------- +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (Assertion, testCase, (@?=)) + +-------------------------------------------------------------------------------- +import Hakyll.Core.Identifier +import Hakyll.Core.Provider +import Hakyll.Core.Store (Store) +import Hakyll.Web.Tags +import TestSuite.Util + +tests :: TestTree +tests = testGroup "Hakyll.Web.Tags" + [ testCase "testGetCategory" testGetCategory + ] + +testGetCategory :: Assertion +testGetCategory = do + store <- newTestStore + provider <- newTestProvider store + + noCategory <- testCategoryDone store provider "example.md" + noCategory @?= [""] + + oneCategory1 <- testCategoryDone store provider "posts/2010-08-26-birthday.md" + oneCategory1 @?= ["posts"] + + oneCategory2 <- testCategoryDone store provider "posts/2019/05/10/tomorrow.md" + oneCategory2 @?= ["10"] + + cleanTestEnv + +-------------------------------------------------------------------------------- +testCategoryDone :: Store -> Provider -> Identifier -> IO [String] +testCategoryDone store provider identifier = + testCompilerDone store provider identifier $ getCategory identifier |