Test fixtures ná an socrú seasta (sonraí, réada, staid) atá ag teastáil ó thástáil chun rith, agus setup/teardown modhanna a ullmhódh agus a ghlanadh an comhthéacs seo roimh agus i ndiaidh tástáil. Laghdaíonn siad dúbláil agus cinntíonn siad go rithfidh tástáil i staid chomhsheasmhach, fhálaithe.
Setup agus teardown
SETUP → runs BEFORE tests to prepare the context (create objects, data, connections)
TEARDOWN → runs AFTER tests to CLEAN UP (close connections, delete data, reset state)
→ frameworks provide hooks:
beforeEach / afterEach → before/after EACH test (fresh state per test — common)
beforeAll / afterAll → once before/after ALL tests in a group (shared expensive setup)
(, {
service, db;
( {
db = ();
service = (db);
});
( db.());
(, { });
});
