Module

Test.Unit

Package
purescript-test-unit
Repository
bodil/purescript-test-unit

#Test Source

type Test e = Aff e Unit

#success Source

success :: forall e. Test e

The basic value for a succeeding test.

#failure Source

failure :: forall e. String -> Test e

Make a failing test, given a reason for the failure.

#timeout Source

timeout :: forall e. Int -> Test (avar :: AVAR, timer :: TIMER | e) -> Test (avar :: AVAR, timer :: TIMER | e)

Set a test to fail after a given number of milliseconds.

#Group Source

data Group e

Constructors

#TestF Source

data TestF e a

Constructors

Instances

#TestSuite Source

type TestSuite e = Free (TestF e) Unit

#suite Source

suite :: forall e. String -> TestSuite e -> TestSuite e

Define a test suite, which can contain a number of nested suites as well as tests.

#test Source

test :: forall e. String -> Test e -> TestSuite e

Define a labelled test.

#TestList Source

type TestList e = List (Tuple (List String) (Test e))

A list of collected tests, represented as a tuple of each test's path and the Test itself. The path, in this case, means the name of the test preceded by the name of each parent test suite, in top down order.

#walkSuite Source

walkSuite :: forall e. (List String -> TestF (avar :: AVAR | e) (TestSuite (avar :: AVAR | e)) -> Aff (avar :: AVAR | e) Unit) -> TestSuite (avar :: AVAR | e) -> Aff (avar :: AVAR | e) (TestList (avar :: AVAR | e))

Walk through a test suite, calling the provided function for each item, and returning a TestList of all tests walked. The tests won't actually run unless you run them explicitly from your walker function.

#collectTests Source

collectTests :: forall e. TestSuite (avar :: AVAR | e) -> Aff (avar :: AVAR | e) (TestList (avar :: AVAR | e))

Walk through a test suite, returning a TestList of all tests walked. This operation will not actually run the tests.

#collectResults Source

collectResults :: forall e. TestList e -> Aff e (List (Tuple (List String) (Either Error Unit)))

Run a list of tests and collect each test result.

#keepErrors Source

keepErrors :: List (Tuple (List String) (Either Error Unit)) -> List (Tuple (List String) Error)

Filter successes out of a list of test results.

#describe Source

describe :: forall e. String -> TestSuite e -> TestSuite e

describe is an alias for suite for BDD enthusiasts.

#it Source

it :: forall e. String -> Test e -> TestSuite e

it is an alias for test for BDD enthusiasts.