sydtest-persistent-0.0.0.2: A persistent companion library for sydtest
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Syd.Persistent

Description

Testing with an in-memory sqlite database using persistent-sqlite

Synopsis

Documentation

runSqlPool :: forall backend m a. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> Pool backend -> m a #

Get a connection from the pool, run the given action, and then return the connection to the pool.

This function performs the given action in a transaction. If an exception occurs during the action, then the transaction is rolled back.

Note: This function previously timed out after 2 seconds, but this behavior was buggy and caused more problems than it solved. Since version 2.1.2, it performs no timeout checks.

runPersistentTest :: ConnectionPool -> SqlPersistM a -> IO a Source #

A flipped version of runSqlPool to run your tests

migrationRunner :: MonadIO m => Migration -> ReaderT SqlBackend m () Source #

Helper function to run a Migration before/in a test suite that works accross versions of persistent.

migrationsSucceedsSpecHelper Source #

Arguments

:: (Migration -> SetupFunc ConnectionPool)

Setupfunc for a ConnectionPool. This will be passed an empty migration

-> FilePath 
-> Migration 
-> Spec 

Test that the given migration succeeds, when applied to the current database.

This uses two tests:

  1. A golden test for the current migration.
  2. A test that first applies the golden migration, and then the current migration, tee see if that fails.

Orphan instances

IsTest (SqlPersistM ()) Source # 
Instance details

Associated Types

type Arg1 (SqlPersistM ()) #

type Arg2 (SqlPersistM ()) #

Methods

runTest :: SqlPersistM () -> TestRunSettings -> ProgressReporter -> ((Arg1 (SqlPersistM ()) -> Arg2 (SqlPersistM ()) -> IO ()) -> IO ()) -> IO TestRunResult #

IsTest (outerArgs -> SqlPersistM ()) Source # 
Instance details

Associated Types

type Arg1 (outerArgs -> SqlPersistM ()) #

type Arg2 (outerArgs -> SqlPersistM ()) #

Methods

runTest :: (outerArgs -> SqlPersistM ()) -> TestRunSettings -> ProgressReporter -> ((Arg1 (outerArgs -> SqlPersistM ()) -> Arg2 (outerArgs -> SqlPersistM ()) -> IO ()) -> IO ()) -> IO TestRunResult #