about summary refs log tree commit diff
path: root/tools/website-blocker/Spec.hs
blob: b70d8619cb25e3d63872a292472024a9f1d798e8 (plain) (blame)
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
32
33
34
35
36
37
38
module Spec (main) where

--------------------------------------------------------------------------------
-- Dependencies
--------------------------------------------------------------------------------

import qualified Main as Main

import Test.Hspec

--------------------------------------------------------------------------------
-- Tests
--------------------------------------------------------------------------------

main :: IO ()
main = hspec $ do
  describe "getRules" $ do
    it "returns the parsed rules from rules.json" $ do
      rules <- Main.getRules
      rules `shouldBe` [ Main.Rule { Main.urls = [ Main.URL "facebook.com"
                                                 , Main.URL "www.facebook.com"
                                                 , Main.URL "twitter.com"
                                                 , Main.URL "www.twitter.com"
                                                 , Main.URL "youtube.com"
                                                 , Main.URL "www.youtube.com"
                                                 , Main.URL "instagram.com"
                                                 , Main.URL "www.instagram.com"
                                                 ]
                                   , Main.allowed = []
                                   }
                       , Main.Rule { Main.urls = [ Main.URL "chat.googleplex.com" ]
                                   , Main.allowed = []
                                   }
                       ]

  describe "Prelude.head" $ do
    it "returns the first element of a list" $ do
      head [23 ..] `shouldBe` (23 :: Int)