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

ActionClientTest overview

Test utilities for ActionClient service.

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

Example

import { ActionClient, ActionClientTest } from "@effect-native/platform-github"
import { Effect } from "effect"

const layer = ActionClientTest.make({
  requestResult: { data: { login: "octocat" } }
})
const program = ActionClient.request<{ data: { login: string } }>("GET /user").pipe(Effect.provide(layer))
// Effect.runPromise(program) // => { data: { login: "octocat" } }

Added in v1.0.0


Table of contents


constructors

make

Creates a test layer for ActionClient with the given options.

Signature

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

Added in v1.0.0

layers

layer

A default test layer that returns empty results.

Signature

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

Added in v1.0.0

models

TestOptions (interface)

Options for creating a test ActionClient layer.

Signature

export interface TestOptions {
  readonly requestResult?: unknown | Error
  readonly graphqlResult?: unknown | Error
  readonly paginateResult?: Array<unknown> | Error
}

Added in v1.0.0