@fluidframework/test-utils Package

Packages > @fluidframework/test-utils

Classes

List of classes contained in this package or namespace
Class Description
LoaderContainerTracker
LocalCodeLoader A simple code loader that caches a mapping of package name to a Fluid entry point. On load, it retrieves the entry point matching the package name in the given code details.
OpProcessingController Class with access to the local delta connection server and delta managers that can control op processing.
TestFluidObject A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load. The shared objects can be retrieved by passing the key of the entry to getSharedObject. It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.
TestFluidObjectFactory Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime with the object factories in the entry list. All the entries with an id other than undefined are passed to the Fluid object so that it can create a shared object for each.For example, the following will create a Fluid object that creates and loads a SharedString and SharedDirectory. It will add SparseMatrix to the data store's factory so that it can be created later. new TestFluidObjectFactory([ [ "sharedString", SharedString.getFactory() ], [ "sharedDirectory", SharedDirectory.getFactory() ], [ undefined, SparseMatrix.getFactory() ], ]);The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows: sharedString = testFluidObject.getSharedObject("sharedString"); sharedDir = testFluidObject.getSharedObject("sharedDirectory");
TestObjectProvider Shared base class for test object provider. Contain code for loader and container creation and loading

Enumerations

List of enums contained in this package or namespace
Enumeration Description
DataObjectFactoryType

Functions

List of functions contained in this package or namespace
Function Description
createAndAttachContainer(source, loader, attachRequest) Creates a detached Container and attaches it.
createLoader(packageEntries, documentServiceFactory, urlResolver, logger, options) Creates a loader with the given package entries and driver.
timeoutPromise(executor, timeoutOptions)

Interfaces

List of interfaces contained in this package or namespace
Interface Description
IDeltaConnectionServerMonitor
IOpProcessingController
IProvideTestFluidObject
ITestContainerConfig
ITestFluidObject
ITestObjectProvider
TimeoutWithError
TimeoutWithValue

Variables

List of variables contained in this package or namespace
Variable Description
createDocumentId
createTestContainerRuntimeFactory Create a container runtime factory class that allows you to set runtime options
defaultTimeoutDurationMs
TestContainerRuntimeFactory A container runtime factory that allows you to set runtime options

Type Aliases

List of type aliases contained in this package or namespace
Type Alias Description
ChannelFactoryRegistry
DeltaManager
fluidEntryPoint
SupportedExportInterfaces

Enumerations

DataObjectFactoryType enum

Signature:

export declare enum DataObjectFactoryType 

Enumeration Members

List of members in use in this enum
Member Value Description
Primed 0
Test 1

Functions

createAndAttachContainer

Creates a detached Container and attaches it.

Signature:

export declare function createAndAttachContainer(source: IFluidCodeDetails, loader: IHostLoader, attachRequest: IRequest): Promise<IContainer>;

Parameters

List of parameters
Parameter Type Description
source IFluidCodeDetails The code details used to create the Container.
loader IHostLoader The loader to use to initialize the container.
attachRequest IRequest The request to create new from.

Returns:

Promise<IContainer>

createLoader

Creates a loader with the given package entries and driver.

Signature:

export declare function createLoader(packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>, documentServiceFactory: IDocumentServiceFactory, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger, options?: ILoaderOptions): IHostLoader;

Parameters

List of parameters
Parameter Type Description
packageEntries Iterable<[IFluidCodeDetails, fluidEntryPoint]> A list of code details to Fluid entry points.
documentServiceFactory IDocumentServiceFactory the driver factory to use
urlResolver IUrlResolver the url resolver to use
logger ITelemetryBaseLogger
options ILoaderOptions loader options

Returns:

IHostLoader

timeoutPromise

Signature:

export declare function timeoutPromise<T = void>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T | void>;

Parameters

List of parameters
Parameter Type Description
executor (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void
timeoutOptions TimeoutWithError | TimeoutWithValue

Returns:

Promise<T | void>

Variables

createDocumentId

Signature:

createDocumentId: () => string

createTestContainerRuntimeFactory

Create a container runtime factory class that allows you to set runtime options

Signature:

createTestContainerRuntimeFactory: (containerRuntimeCtor: typeof ContainerRuntime) => {
    new (type: string, dataStoreFactory: IFluidDataStoreFactory, runtimeOptions?: IContainerRuntimeOptions): {
        readonly IRuntimeFactory: any;
        type: string;
        dataStoreFactory: IFluidDataStoreFactory;
        runtimeOptions: IContainerRuntimeOptions;
        instantiateRuntime(context: IContainerContext): Promise<IRuntime>;
    };
}

defaultTimeoutDurationMs

Signature:

defaultTimeoutDurationMs = 250

TestContainerRuntimeFactory

A container runtime factory that allows you to set runtime options

Signature:

TestContainerRuntimeFactory: {
    new (type: string, dataStoreFactory: IFluidDataStoreFactory, runtimeOptions?: IContainerRuntimeOptions): {
        readonly IRuntimeFactory: any;
        type: string;
        dataStoreFactory: IFluidDataStoreFactory;
        runtimeOptions: IContainerRuntimeOptions;
        instantiateRuntime(context: IContainerContext): Promise<IRuntime>;
    };
}

Type Aliases

ChannelFactoryRegistry

Signature:

export declare type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;

DeltaManager

Signature:

export declare type DeltaManager = IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;

fluidEntryPoint

Signature:

export declare type fluidEntryPoint = SupportedExportInterfaces | IFluidModule;

SupportedExportInterfaces

Signature:

export declare type SupportedExportInterfaces = Partial<IProvideRuntimeFactory & IProvideFluidDataStoreFactory & IProvideFluidDataStoreRegistry & IProvideFluidCodeDetailsComparer>;