Skip to main content Link Search Menu Expand Document (external link)

ActionContextTest overview

Test utilities for ActionContext service.

Provides a mock layer factory for testing actions that use ActionContext.

Example

import { ActionContext, ActionContextTest } from "@effect-native/platform-github"
import { Effect } from "effect"

const layer = ActionContextTest.make({ eventName: "pull_request", actor: "octocat" })
const program = ActionContext.eventName.pipe(Effect.provide(layer))
// Effect.runSync(program) // => "pull_request"

Added in v1.0.0


Table of contents


constructors

make

Creates a test layer for ActionContext with the given options.

Signature

export declare const make: (options?: TestOptions) => Layer.Layer<ActionContext>

Added in v1.0.0

layers

layer

A default test layer with sensible defaults.

Signature

export declare const layer: Layer.Layer<ActionContext, never, never>

Added in v1.0.0

models

TestOptions (interface)

Options for creating a test ActionContext layer.

Signature

export interface TestOptions {
  readonly eventName?: string
  readonly payload?: Record<string, unknown>
  readonly workflow?: string
  readonly action?: string
  readonly actor?: string
  readonly job?: string
  readonly runId?: number
  readonly runNumber?: number
  readonly runAttempt?: number
  readonly ref?: string
  readonly sha?: string
  readonly apiUrl?: string
  readonly serverUrl?: string
  readonly graphqlUrl?: string
  readonly repo?: { owner: string; repo: string } | Error
  readonly issue?: { owner: string; repo: string; number: number } | Error
}

Added in v1.0.0