Skip to main content

testing

@prismatic-io/spectral"testing"

Index#

Classes#

Interfaces#

Functions#

Object literals#

Functions#

Const createConnection#

createConnectionT›(__namedParameters: object, values: Record‹string, unknown›): ConnectionValue

Defined in packages/spectral/src/testing.ts:35

Type parameters:

T: ConnectionDefinition

Parameters:

__namedParameters: object

NameType
keystring

values: Record‹string, unknown›

Returns: ConnectionValue


Const createHarness#

createHarnessTComponent›(component: TComponent): ComponentTestHarness‹TComponent›

Defined in packages/spectral/src/testing.ts:300

Type parameters:

TComponent: Component

Parameters:

NameType
componentTComponent

Returns: ComponentTestHarness‹TComponent›


Const defaultTriggerPayload#

defaultTriggerPayload(): TriggerPayload

Defined in packages/spectral/src/testing.ts:115

Returns: TriggerPayload


Const invoke#

invokeTInputs, TAllowsBranching, TReturn›(__namedParameters: object, params: ActionInputParameters‹TInputs›, context?: Partial‹ActionContext›): Promise‹InvokeReturn‹TReturn››

Defined in packages/spectral/src/testing.ts:97

Invokes specified ActionDefinition perform function using supplied params and optional context. Accepts a generic type matching ActionPerformReturn as a convenience to avoid extra casting within test methods. Returns an InvokeResult containing both the action result and a mock logger for asserting logging.

Type parameters:

TInputs: Inputs

TAllowsBranching: boolean

TReturn: InvokeActionPerformReturn‹TAllowsBranching, unknown›

Parameters:

__namedParameters: object

NameType
performfunction

params: ActionInputParameters‹TInputs›

Optional context: Partial‹ActionContext

Returns: Promise‹InvokeReturn‹TReturn››


Const invokeDataSource#

invokeDataSourceTInputs, TDataSourceType›(__namedParameters: object, params: ActionInputParameters‹TInputs›, context?: Partial‹DataSourceContext›): Promise‹InvokeDataSourceResult‹TDataSourceType››

Defined in packages/spectral/src/testing.ts:207

Invokes specified DataSourceDefinition perform function using supplied params. Accepts a generic type matching DataSourceResult as a convenience to avoid extra casting within test methods. Returns a DataSourceResult.

Type parameters:

TInputs: Inputs

TDataSourceType: DataSourceType

Parameters:

__namedParameters: object

NameType
performfunction

params: ActionInputParameters‹TInputs›

Optional context: Partial‹DataSourceContext

Returns: Promise‹InvokeDataSourceResult‹TDataSourceType››


Const invokeTrigger#

invokeTriggerTInputs, TAllowsBranching, TResult›(__namedParameters: object, context?: Partial‹ActionContext›, payload?: TriggerPayload, params?: ActionInputParameters‹TInputs›): Promise‹InvokeReturn‹TResult››

Defined in packages/spectral/src/testing.ts:159

Invokes specified TriggerDefinition perform function using supplied params and optional context. Accepts a generic type matching TriggerResult as a convenience to avoid extra casting within test methods. Returns an InvokeResult containing both the trigger result and a mock logger for asserting logging.

Type parameters:

TInputs: Inputs

TAllowsBranching: boolean

TResult: InvokeTriggerResult‹TAllowsBranching›

Parameters:

__namedParameters: object

NameType
performfunction

Optional context: Partial‹ActionContext

Optional payload: TriggerPayload

Optional params: ActionInputParameters‹TInputs›

Returns: Promise‹InvokeReturn‹TResult››


Const loggerMock#

loggerMock(): ActionLogger

Defined in packages/spectral/src/testing.ts:48

Pre-built mock of ActionLogger. Suitable for asserting logs are created as expected. See https://prismatic.io/docs/custom-components/writing-custom-components/#verifying-correct-logging-in-action-tests for information on testing correct logging behavior in your custom component.

Returns: ActionLogger

Object literals#

Const baseActionContext#

baseActionContext: object#

Defined in packages/spectral/src/testing.ts:58

crossFlowState#

crossFlowState: object

Defined in packages/spectral/src/testing.ts:61

Type declaration:#

executionId#

executionId: string = "mockExecutionId"

Defined in packages/spectral/src/testing.ts:64

executionState#

executionState: object

Defined in packages/spectral/src/testing.ts:62

Type declaration:#

instanceState#

instanceState: object

Defined in packages/spectral/src/testing.ts:60

Type declaration:#

invokeUrl#

invokeUrl: string = "https://example.com"

Defined in packages/spectral/src/testing.ts:71

logger#

logger: ActionLogger = loggerMock()

Defined in packages/spectral/src/testing.ts:59

stepId#

stepId: string = "mockStepId"

Defined in packages/spectral/src/testing.ts:63

customer: object

Defined in packages/spectral/src/testing.ts:72

  • externalId: string = "1234"

  • id: string = "customerId"

  • name: string = "Customer 1"

instance: object

Defined in packages/spectral/src/testing.ts:77

  • id: string = "instanceId"

  • name: string = "Instance 1"

webhookApiKeys: object

Defined in packages/spectral/src/testing.ts:68

  • Flow 1: string[] = ["example-123", "example-456"]

webhookUrls: object

Defined in packages/spectral/src/testing.ts:65


Const baseDataSourceContext#

baseDataSourceContext: object#

Defined in packages/spectral/src/testing.ts:189

logger#

logger: ActionLogger = loggerMock()

Defined in packages/spectral/src/testing.ts:190

customer: object

Defined in packages/spectral/src/testing.ts:191

  • externalId: string = "1234"

  • id: string = "customerId"

  • name: string = "Customer 1"

instance: object

Defined in packages/spectral/src/testing.ts:196

  • id: string = "instanceId"

  • name: string = "Instance 1"