hledger-web-1.32.2: Web user interface for the hledger accounting system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hledger.Web.Test

Description

Test suite for hledger-web.

Dev notes:

http://hspec.github.io/writing-specs.html

https://hackage.haskell.org/package/yesod-test-1.6.10/docs/Yesod-Test.html

"The best way to see an example project using yesod-test is to create a scaffolded Yesod project: stack new projectname yesodweb/sqlite (See https://github.com/commercialhaskell/stack-templates/wiki#yesod for the full list of Yesod templates)"

These tests don't exactly match the production code path, eg these bits are missing:

withJournalDo copts (web wopts) -- extra withJournalDo logic (journalTransform..) ... -- query logic, more options logic let depthlessinitialq = filterQuery (not . queryIsDepth) . _rsQuery . reportspec_ $ cliopts_ wopts j' = filterJournalTransactions depthlessinitialq j h = host_ wopts p = port_ wopts u = base_url_ wopts staticRoot = T.pack $ file_url_ wopts appconfig = AppConfig{appEnv = Development ,appHost = fromString h ,appPort = p ,appRoot = T.pack u ,appExtra = Extra "" Nothing staticRoot }

The production code path, when called in this test context, which I guess is using yesod's dev mode, needs to read .configsettings.yml and fails without it (loadConfig).

Synopsis

Documentation

hledgerWebTest :: IO () Source #

Run hledger-web's built-in tests using the hspec test runner.