Skip to main content
Version: v1

@fluidframework/test-runtime-utils Package

Interfaces

Interface Description
IMockContainerRuntimePendingMessage

Classes

Class Description
InsecureTokenProvider

Provides an in memory implementation of ITokenProvider that can be used to insecurely connect to the Fluid Relay.

As the name implies, this is not secure and should not be used in production. It simply makes examples where authentication is not relevant easier to bootstrap.

MockContainerRuntime Mock implementation of ContainerRuntime for testing basic submitting and processing of messages. If test specific logic is required, extend this class and add the logic there. For an example, take a look at MockContainerRuntimeForReconnection.
MockContainerRuntimeFactory Factory to create MockContainerRuntime for testing basic submitting and processing of messages. This also acts as a very basic server that stores the messages from all the MockContainerRuntimes and processes them when asked. If test specific logic is required, extend this class and add the logic there. For an example, take a look at MockContainerRuntimeFactoryForReconnection.
MockContainerRuntimeFactoryForReconnection Specalized implementation of MockContainerRuntimeFactory for testing ops during reconnection.
MockContainerRuntimeForReconnection Specalized implementation of MockContainerRuntime for testing ops during reconnection.
MockDeltaConnection Mock implementation of IDeltaConnection for testing
MockDeltaManager Mock implementation of IDeltaManager for testing that creates mock DeltaQueues for testing
MockDeltaQueue Mock implementation of IDeltaQueue for testing that does nothing
MockEmptyDeltaConnection Mock implementation of IDeltaConnection
MockFluidDataStoreContext
MockFluidDataStoreRuntime Mock implementation of IRuntime for testing that does nothing
MockHandle Mock implementation of IFluidHandle.
MockObjectStorageService Mock implementation of IChannelStorageService
MockQuorumClients
MockSharedObjectServices Mock implementation of IChannelServices
MockStorage Mock implementation of IChannelStorageService based on ITree input.

Functions

Function Return Type Description
validateAssertionError(error, expectedErrorMsg) boolean Validates that an error thrown by our assert() function has the expected message, or a short code that corresponds to that message.

Function Details

validateAssertionError

Validates that an error thrown by our assert() function has the expected message, or a short code that corresponds to that message.

Signature

export declare function validateAssertionError(error: Error, expectedErrorMsg: string): boolean;

Remarks

The main use case for this is so tests that expect specific assert() calls to fail can always do comparisons based on the original string message, and work whether they run before the policy-check tool replaces those strings with short codes, or after. Note that it either returns true or throws an error (the behavior expected by NodeJS' assert.throws()).

Parameters

Parameter Type Description
error Error The error object thrown by our assert() function. Its message property could be a short code, or the original string message coded into the asert().
expectedErrorMsg string

Returns

  • true if the message in the error object that was passed in matches the expected message. Otherwise it throws an error.

Return type: boolean