zidane-ui/ channels/ testing
import { … } from 'zidane-ui/channels/testing'ui/src/channels/testing/index.ts
Functions#
createFixtureChannelsHostFunction#
zidane-ui/channels/testing: a ChannelsHost that runs in memory (createFixtureChannelsHost) over the
channels methods as zidane answers them (createFixtureChannelsMethods), for docs, demos, galleries and an app's
own tests. Not for production hosts.
function createFixtureChannelsHost(seed?: FixtureChannelsSeed): FixtureChannelsHostParameters
| Name | Type | Default | Description |
|---|---|---|---|
| seed? | FixtureChannelsSeed | {} | What it starts with. |
Returns
createFixtureChannelsMethodsFunction#
zidane-ui/channels/testing: a ChannelsHost that runs in memory (createFixtureChannelsHost) over the
channels methods as zidane answers them (createFixtureChannelsMethods), for docs, demos, galleries and an app's
own tests. Not for production hosts.
function createFixtureChannelsMethods(
seed?: FixtureChannelsSeed,
): FixtureChannelsMethodsParameters
| Name | Type | Default | Description |
|---|---|---|---|
| seed? | FixtureChannelsSeed | {} | What it starts with. |
Returns
fixtureChannelAgentFunction#
zidane-ui/channels/testing: a ChannelsHost that runs in memory (createFixtureChannelsHost) over the
channels methods as zidane answers them (createFixtureChannelsMethods), for docs, demos, galleries and an app's
own tests. Not for production hosts.
function fixtureChannelAgent(): ChannelAgentReturns
ChannelAgentfixtureChannelBindingsFunction#
zidane-ui/channels/testing: a ChannelsHost that runs in memory (createFixtureChannelsHost) over the
channels methods as zidane answers them (createFixtureChannelsMethods), for docs, demos, galleries and an app's
own tests. Not for production hosts.
function fixtureChannelBindings(): ChannelBinding[]Returns
fixtureChannelConnectionsFunction#
zidane-ui/channels/testing: a ChannelsHost that runs in memory (createFixtureChannelsHost) over the
channels methods as zidane answers them (createFixtureChannelsMethods), for docs, demos, galleries and an app's
own tests. Not for production hosts.
function fixtureChannelConnections(): ChannelConnection[]Returns
Interfaces#
FixtureChannelsHostInterface#
The fixture's host, with its methods.
interface FixtureChannelsHost extends ChannelsHostStateProperties
| Name | Type | Description |
|---|---|---|
agent?from ChannelsHostState | ChannelsAgent | The org's Agent. Absent: no Agent card and no Agent row. |
alerts?from ChannelsHostState | ChannelsAlerts | The caller's open channel alerts. Absent: no alerts list. |
applyfrom ChannelsHostState | (signal: { kind: string }) => void | A signal of the host: reads again what it touches. Other kinds are ignored. |
bindings?from ChannelsHostState | ChannelsBindings | A project's bindings (Project settings › Channels). Absent: no Channels section. |
connections?from ChannelsHostState | ChannelsConnections | The host's connections (Settings › Channels). Absent: no Channels page. |
defaultProjectsfrom ChannelsHostState | Readable<Readonly<Record<string, string | null>>> | The defaults set from this window, by connection id ( |
held?from ChannelsHostState | ChannelsHeld | A project's replies the outbound filter held, and their release. Absent: no Held replies list. |
| methods | FixtureChannelsMethods | The methods under it: the provider's side, what it sent. |
openProject?from ChannelsHostState | (projectId: string) => void | Opens a project of the host (its home): the Agent card's Open project. Absent: no Open project. |
openSession?from ChannelsHostState | (sessionId: string) => void | Opens a session of the host (a test session). Absent: Test as opens it in the background. |
openTarget?from ChannelsHostState | (target: ReadinessOpenTarget, projectId?: string) => void | Opens a screen of the app a readiness fix names (Settings › Channels, Linked accounts). The project's own screens
open its settings in the kit. Absent: those fixes show without a button. |
readiness?from ChannelsHostState | ChannelsReadiness | A project's readiness checklist. Absent: no checklist. |
setDefaultProject?from ChannelsHostState | (connectionId: string, projectId: string | null) => Promise<void> | Sets ( |
testAs?from ChannelsHostState | (projectId: string, bindingId: string, as: TestAsKind, identity: { iconUrl?: string; name: string }) => Promise<TestSession> | Opens a private session with a binding's exact rules for a member or a guest. Absent: no Test as.
|
testSessionsfrom ChannelsHostState | Readable<Readonly<Record<string, TestSession>>> | The test sessions opened in this window, by session id. |
wakefrom ChannelsHostState | () => void | Reads again everything read so far (a new connection). |
FixtureChannelsMethodsInterface#
The fixture's methods, with the provider's side and what it sent.
interface FixtureChannelsMethods extends ChannelsBackendProperties
| Name | Type | Description |
|---|---|---|
callfrom ChannelsBackend | <M extends 'projects.readiness' | 'channels.bindings.testAs' | 'channels.connections.list' | 'channels.connections.get' | 'channels.connections.create' | 'channels.connections.update' | 'channels.connections.remove' | 'channels.connections.status' | 'channels.connections.slackManifest' | 'channels.connections.slackCredentials' | 'channels.connections.slackInstall' | 'channels.connections.githubManifest' | 'channels.bindings.list' | 'channels.runsOn' | 'channels.bindings.put' | 'channels.bindings.remove' | 'channels.bindings.enable' | 'channels.conversations' | 'channels.defaultProject' | 'channels.held.list' | 'channels.held.release' | 'channels.alerts.list' | 'channels.agent.get' | 'channels.agent.set'>(method: M, params: ChannelsParams<M>) => Promise<ChannelsResult<M>> | Calls a method. Rejects with the host's error (the adapter's own type; |
| calls | { method: string; params: unknown }[] | Every call made, in order: method and params. |
canfrom ChannelsBackend | (method: 'projects.readiness' | 'channels.bindings.testAs' | 'channels.connections.list' | 'channels.connections.get' | 'channels.connections.create' | 'channels.connections.update' | 'channels.connections.remove' | 'channels.connections.status' | 'channels.connections.slackManifest' | 'channels.connections.slackCredentials' | 'channels.connections.slackInstall' | 'channels.connections.githubManifest' | 'channels.bindings.list' | 'channels.runsOn' | 'channels.bindings.put' | 'channels.bindings.remove' | 'channels.bindings.enable' | 'channels.conversations' | 'channels.defaultProject' | 'channels.held.list' | 'channels.held.release' | 'channels.alerts.list' | 'channels.agent.get' | 'channels.agent.set') => boolean | Whether the host offers a method. A method it does not offer hides what needs it. |
classify?from ChannelsBackend | (err: unknown) => ChannelsError | Words a rejection. Default: |
| clearAlert | (id: string) => void | An alert clears on recovery ( |
| completeGithubManifest | (connectionId: string, slug?: string) => void | GitHub's manifest flow came back: the connection holds its App's key and runs. |
| completeSlackInstall | (connectionId: string, teamName?: string, teamId?: string) => void | Slack's OAuth page came back: the connection holds a bot token and runs. One that replaces another takes its
bindings: all of them in the same workspace ( |
| defaults | Map<string, string | null> | The defaults people set, by connection id. |
| onSignal | (listener: (signal: ChannelsSignal) => void) => () => void | Calls |
| openAlert | (alert: ChannelAlert) => void | An alert opens for the caller ( |
publicUrl?from ChannelsBackend | boolean | The host serves https webhooks at a public URL, so a Slack app can use HTTP instead of Socket Mode. Default false. |
runFix?from ChannelsBackend | (method: string, params: Record<string, unknown>) => Promise<unknown> | Calls the method a readiness fix names ( |
| setReadiness | (projectId: string, items: readonly ReadinessItem[]) => void | Replaces a project's extra readiness items, and says so ( |
| setState | (state: ConnectionLiveState) => void | A connection's live state changes ( |
FixtureChannelsProjectInterface#
A project the fixture knows: its id and name.
interface FixtureChannelsProjectProperties
| Name | Type | Description |
|---|---|---|
| id | string | Its id. |
| name | string | Its name. |
FixtureChannelsSeedInterface#
What a fixture starts with.
interface FixtureChannelsSeedProperties
| Name | Type | Description |
|---|---|---|
| agent? | ChannelAgent | null | The org's Agent ( |
| alerts? | readonly ChannelAlert[] | The caller's open alerts ( |
| bindings? | readonly ChannelBinding[] | The bindings. Default: |
| connections? | readonly ChannelConnection[] | The connections. Default: |
| conversations? | Readonly<Record<string, readonly Omit<ChannelConversation, 'boundBy'>[]>> | The Slack channels each connection's app is in. Default: |
| held? | readonly HeldPost[] | The replies the outbound filter held ( |
| projects? | readonly FixtureChannelsProject[] | The projects. Default |
| publicUrl? | boolean | The host serves a public URL (Slack's HTTP transport). Default false. |
| readiness? | Readonly<Record<string, readonly ReadinessItem[]>> | Items each project's checklist adds to the ones the fixture computes. |
| without? | readonly ('projects.readiness' | 'channels.bindings.testAs' | 'channels.connections.list' | 'channels.connections.get' | 'channels.connections.create' | 'channels.connections.update' | 'channels.connections.remove' | 'channels.connections.status' | 'channels.connections.slackManifest' | 'channels.connections.slackCredentials' | 'channels.connections.slackInstall' | 'channels.connections.githubManifest' | 'channels.bindings.list' | 'channels.runsOn' | 'channels.bindings.put' | 'channels.bindings.remove' | 'channels.bindings.enable' | 'channels.conversations' | 'channels.defaultProject' | 'channels.held.list' | 'channels.held.release' | 'channels.alerts.list' | 'channels.agent.get' | 'channels.agent.set')[] | Methods to leave out, so a test can check what hides without them. |