← back to backlog: veritas

State-Passing Fixtures (Setup/Teardown Context)

status

todo

type

task

description

Veritas allows #:before and #:after hooks that accept a context (vc). To make these incredibly powerful, ensure that hooks can transform and pass state cleanly into the tests.

The Improvement: If a #:before hook sets up a temporary database connection or a mock file descriptor, it should return that resource wrapped in the context, which is then cleanly passed as an argument directly into the test thunks.

How it looks:

Scheme

(test "Read from temp DB"

#:before (lambda (vc) (setup-mock-db)) ; returns db-conn

(lambda (db-conn) ; test body accepts the fixture

(assert-true (db-active? db-conn))))

veritas-365