Beignet API reference
    Preparing search index...

    Function createTestContext

    • Create a one-call test context fixture for jobs, listeners, schedules, notifications, payments, tasks, and use-case tests.

      The fixture builds common memory ports through createTestPorts(...), assembles an app context with actor, tenant, request ID, trace ID, auth, and a live bound gate, and enters the ambient request context so ambient enrichment matches production. Reading an app port that is neither a kit default nor supplied throws a named error on use.

      Type Parameters

      Returns (
          options?: CreateTestContextOptions<Ctx, Ctx["ports"]>,
      ) => TestContextFixture<Ctx, Ctx["ports"]>

      A factory that creates one disposable test context fixture.

      const makeContext = createTestContext<AppContext>();

      using fixture = makeContext({
      ports: { issues: { create: async (input) => issueRecord(input) } },
      });
      await runCreateIssue(fixture.ctx);