module Niv.Sources.Test where

import qualified Data.ByteString.Lazy as BL
import qualified Data.Digest.Pure.MD5 as MD5
import qualified Data.Text as T
import Niv.Sources
import Test.Tasty.HUnit ((@=?))

-- | Ensure that the sources.nix we ship is tracked as the latest version
test_shippedSourcesNixIsLatest :: IO ()
test_shippedSourcesNixIsLatest :: IO ()
test_shippedSourcesNixIsLatest =
  Text
latestVersionMD5
    forall a. (Eq a, Show a, HasCallStack) => a -> a -> IO ()
@=? (String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> MD5Digest
MD5.md5 forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString
BL.fromStrict forall a b. (a -> b) -> a -> b
$ ByteString
initNixSourcesNixContent)