UNPKG

testeranto

Version:

the AI powered BDD test framework for typescript projects

31 lines (30 loc) 1.12 kB
import { MockCore } from "./MockCore"; export const testAdapter = { beforeEach: async (subject, initializer, testResource, initialValues, pm) => { var _a; try { const result = await initializer(); if (!result) { throw new Error("Initializer returned undefined"); } if (!(result instanceof MockCore)) { throw new Error(`Initializer returned ${(_a = result === null || result === void 0 ? void 0 : result.constructor) === null || _a === void 0 ? void 0 : _a.name}, expected MockCore`); } return result; } catch (e) { console.error("[ERROR] BeforeEach failed:", e); throw e; } }, andWhen: async (store, whenCB, testResource, pm) => { return whenCB(store, pm); }, butThen: async (store, thenCB, testResource, pm) => { return thenCB(store, pm); }, afterEach: (store) => store, afterAll: (store, pm) => { }, assertThis: (result) => !!result, beforeAll: async (input, testResource, pm) => input, };