Setu-TS
    Preparing search index...

    Class FixtureManager

    Collects mock plugin definitions and real plugins, produces the IPlugin[] for createTestApp, and resets between tests.

    Integration tests that mock several capabilities at once (e.g. database + cache + logger) build the plugin array via FixtureManager so afterEach(() => fixtures.reset()) is the only teardown needed.

    import { FixtureManager, createTestApp } from '@setu-ts/testing';
    import { RuntimePlugin } from '@setu-ts/runtime';

    const fixtures = new FixtureManager();

    beforeEach(async () => {
    fixtures
    .mock('database', { query: () => [] })
    .mock('cache', { get: () => null, set: () => {} });

    const app = await createTestApp({
    plugins: [RuntimePlugin(), ...fixtures.plugins()],
    });
    });

    afterEach(() => fixtures.reset());

    0.1.0

    Index
    • Registers a mock service under a capability token.

      Parameters

      • name: string

        Plugin name (also the capability token when provides is absent)

      • service: object

        The mock service object

      • Optionaloptions: { priority?: number; provides?: string }

        Optional provides token and priority

      Returns this

      this for chaining