module Gargantext.Utils.Spec where import Prelude import Data.Array (index) import Data.Foldable (all) import Data.Maybe (Maybe(..), isJust) import Data.String (drop, stripPrefix, Pattern(..)) import Data.Tuple (Tuple(..)) import Gargantext.Utils as GU import Gargantext.Utils.Crypto as GUC import Gargantext.Utils.Math as GUM -- import Test.QuickCheck ((===), (/==), (<?>), Result(..)) import Test.Spec (Spec, describe, it) import Test.Spec.Assertions (shouldEqual) import Test.Spec.QuickCheck (quickCheck') spec :: Spec Unit spec = describe "G.Utils" do it "zeroPad 1 works" do GU.zeroPad 1 0 `shouldEqual` "0" GU.zeroPad 1 1 `shouldEqual` "1" GU.zeroPad 1 10 `shouldEqual` "10" it "zeroPad 2 works" do GU.zeroPad 2 0 `shouldEqual` "00" GU.zeroPad 2 1 `shouldEqual` "01" GU.zeroPad 2 10 `shouldEqual` "10" GU.zeroPad 2 100 `shouldEqual` "100" it "zeroPad 3 works" do GU.zeroPad 3 0 `shouldEqual` "000" GU.zeroPad 3 1 `shouldEqual` "001" GU.zeroPad 3 10 `shouldEqual` "010" GU.zeroPad 3 99 `shouldEqual` "099" GU.zeroPad 3 100 `shouldEqual` "100" GU.zeroPad 3 101 `shouldEqual` "101" GU.zeroPad 3 1000 `shouldEqual` "1000" it "log10 10" do GUM.log10 10.0 `shouldEqual` 1.0 it "md5 works" do let text = "The quick brown fox jumps over the lazy dog" let textMd5 = "9e107d9d372bb6826bd81d3542a419d6" GUC.md5 text `shouldEqual` textMd5