5 Copyright : (c) CNRS, 2017-Present
6 License : AGPL + CECILL v3
7 Maintainer : team@gargantext.org
8 Stability : experimental
13 module Utils.Crypto where
15 import Data.Text (Text)
17 import Gargantext.Prelude
18 import Gargantext.Prelude.Utils
20 -- | Crypto Hash tests
23 describe "Hash String with frontend works" $ do
24 let text = "To hash with backend" :: Text
25 let hashed = "8a69a94d164279af2b7d1443ce08da6184b3d7e815406076e148159c284b53c3" :: Hash
26 -- ^ hash from fronted with text above
28 hash text `shouldBe` hashed
30 describe "Hash List with backend works" $ do
31 let list = ["a","b"] :: [Text]
32 let hashed = "ab19ec537f09499b26f0f62eed7aefad46ab9f498e06a7328ce8e8ef90da6d86" :: Hash
33 -- ^ hash from frontend with text above
35 hash list `shouldBe` hashed
37 ------------------------------------------------------------------------
38 -- | TODO property based tests
39 describe "Hash works with any order of list" $ do
40 let hash1 = hash (["a","b"] :: [Text])
41 let hash2 = hash (["b","a"] :: [Text])
43 hash1 `shouldBe` hash2