Skip to main content
Version: Next

mockServices.database.factory()

Home > @backstage/backend-test-utils > mockServices > database > factory

Creates a mock factory for the coreServices.database. Just returns the given knex instance if you supply one, which is useful in combination with the TestDatabases facility. Otherwise, it returns the regular default database factory which reads config settings.

Signature:

factory: (options?: {
knex: Knex;
migrations?: {
skip?: boolean;
};
}) => ServiceFactory<DatabaseService, "plugin", "singleton">

Parameters

Parameter

Type

Description

options

{ knex: Knex; migrations?: { skip?: boolean; }; }

(Optional)

**Returns:**

ServiceFactory<DatabaseService, "plugin", "singleton">