-- |---- Copyright:-- This file is part of the package themoviedb. It is subject to-- the license terms in the LICENSE file found in the top-level-- directory of this distribution and at:---- https://github.com/pjones/themoviedb---- No part of this package, including this file, may be copied,-- modified, propagated, or distributed except according to the terms-- contained in the LICENSE file.---- License: MITmodule TestHelper ( fakeTMDB, fileRequest, fakeNetworkError, mkDay, )whereimport Data.Time (Day (..), fromGregorian)import Network.API.TheMovieDB.Internal.TheMovieDBimport Network.API.TheMovieDB.Internal.Typesimport Test.Tasty.HUnitfakeTMDB :: FilePath -> TheMovieDB a -> IO afakeTMDB path m = do result <- runTheMovieDBWithRequestFunction (fileRequest path) m case result of Left e -> assertFailure (show e) >> fail (show e) Right a -> return afileRequest :: FilePath -> RequestFunctionfileRequest path _ _ = Right <$> readFileLBS pathfakeNetworkError :: RequestFunctionfakeNetworkError _ _ = return $ Left $ ServiceError "fake outage"mkDay :: Integer -> Int -> Int -> Maybe DaymkDay y m d = Just (fromGregorian y m d)