# zidane-ui/settings/testing

Import: `import { … } from 'zidane-ui/settings/testing'`. Source: [ui/src/settings/testing/index.ts](https://github.com/Tahul/zidane/blob/main/ui/src/settings/testing/index.ts).

## Functions

### `createFixturePerformanceHost`

Function.

Creates the in-memory member.

```ts
function createFixturePerformanceHost(
  options?: FixturePerformanceOptions,
): FixturePerformanceHost
```

**Parameters**

- `options?` (`FixturePerformanceOptions`, default `{}`): History, tick rate, whether profiles are busy.

**Returns** `FixturePerformanceHost`

Source: [ui/src/settings/headless/fixture-performance.ts:263](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-performance.ts#L263)

### `createFixtureSettingsAccounts`

Function.

Creates the fixture's `providers` and `mcp` groups.

```ts
function createFixtureSettingsAccounts(
  data?: FixtureSettingsAccountsData,
): FixtureSettingsAccounts
```

**Parameters**

- `data?` (`FixtureSettingsAccountsData`, default `{}`): The providers and servers held, and how sign-ins finish.

**Returns** `FixtureSettingsAccounts`

Source: [ui/src/settings/headless/fixture-accounts.ts:80](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-accounts.ts#L80)

### `createFixtureSettingsHost`

Function.

Creates an in-memory [`SettingsHost`](https://zidane.si/docs/reference/ui-settings-headless.md#SettingsHost).

```ts
function createFixtureSettingsHost(
  options?: FixtureSettingsOptions,
): FixtureSettingsHost
```

**Parameters**

- `options?` (`FixtureSettingsOptions`, default `{}`): The stored settings, and whether it is read-only, may write, or fails reads.

**Returns** `FixtureSettingsHost`: The host and its control.

Source: [ui/src/settings/headless/fixture-host.ts:86](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-host.ts#L86)

### `createFixtureSettingsModels`

Function.

Creates the fixture's `models` group.

```ts
function createFixtureSettingsModels(
  data?: FixtureSettingsModelsData,
): Pick<SettingsHost, 'models'>
```

**Parameters**

- `data?` (`FixtureSettingsModelsData`): The models data; absent: no `models` group.

**Returns** `Pick<SettingsHost, 'models'>`

Source: [ui/src/settings/headless/fixture-models.ts:33](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-models.ts#L33)

### `createFixtureSettingsSections`

Function.

Creates the in-memory catalog and diagnostics members.

```ts
function createFixtureSettingsSections(
  data?: FixtureSettingsSectionsData,
): FixtureSettingsSections
```

**Parameters**

- `data?` (`FixtureSettingsSectionsData`, default `{}`): What they hold. A key left out leaves its group out.

**Returns** `FixtureSettingsSections`

Source: [ui/src/settings/headless/fixture-sections.ts:128](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-sections.ts#L128)

### `fixturePerfSample`

Function.

Sample `n`, deterministic: a smooth wave per process, a spike every 20 samples.

```ts
function fixturePerfSample(n: number, at: number): PerfSample
```

**Parameters**

- `n` (`number`): The sample's index.
- `at` (`number`): Its time.

**Returns** `PerfSample`

Source: [ui/src/settings/headless/fixture-performance.ts:74](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-performance.ts#L74)

## Constants

### `DEMO_MCP_INSTANCES`

Constant.

The running process of `filesystem`, shared by two sessions.

```ts
const DEMO_MCP_INSTANCES: readonly SettingsMcpInstance[]
```

Source: [ui/src/settings/testing/accounts-demo.ts:115](https://github.com/Tahul/zidane/blob/main/ui/src/settings/testing/accounts-demo.ts#L115)

### `DEMO_MCP_SERVERS`

Constant.

MCP servers in every state MCP servers draws.

```ts
const DEMO_MCP_SERVERS: readonly SettingsMcpServer[]
```

Source: [ui/src/settings/testing/accounts-demo.ts:78](https://github.com/Tahul/zidane/blob/main/ui/src/settings/testing/accounts-demo.ts#L78)

### `DEMO_PROVIDERS`

Constant.

Providers in every state Accounts draws.

```ts
const DEMO_PROVIDERS: readonly SettingsProvider[]
```

Source: [ui/src/settings/testing/accounts-demo.ts:15](https://github.com/Tahul/zidane/blob/main/ui/src/settings/testing/accounts-demo.ts#L15)

## Interfaces

### `FixtureExtensionOptions`

Interface.

The extension options of the fixture: the schema, the action rows, their probes and what a run does.

```ts
interface FixtureExtensionOptions
```

**Properties**

- `actions?` (`SettingsExtensionAction[]`): The action rows declared.
- `runs?` (`Record<string, SettingsExtensionActionResult>`): What running each action (keyed `extension:key`) answers; unlisted: `done`. Offers `runAction` with `actions`.
- `schema?` (`WireExtensionConfigSchema`): The options declared.
- `statuses?` (`Record<string, SettingsExtensionActionStatus>`): The probes, keyed `extension:key`.

Source: [ui/src/settings/headless/fixture-sections.ts:45](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-sections.ts#L45)

### `FixtureHostCatalogs`

Interface.

A host's catalogs, as `catalog.*` reports them.

```ts
interface FixtureHostCatalogs
```

**Properties**

- `extensions` (`HostCatalogExtension[]`): The host's extensions.
- `mcps` (`HostCatalogMcp[]`): The host's MCP servers.
- `plugins` (`HostCatalogPlugin[]`): The host's plugins.
- `skills` (`HostCatalogSkill[]`): The host's skills.

Source: [ui/src/settings/headless/fixture-sections.ts:33](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-sections.ts#L33)

### `FixturePerformanceControl`

Interface.

Drives the fixture from outside.

```ts
interface FixturePerformanceControl
```

**Properties**

- `emit` (`(sample: PerfSample) => void`): Emits `sample` to every watcher.
- `profiles` (`() => { seconds: number; target: PerfProfileTarget }[]`): Profiles recorded, in order.
- `resets` (`() => number`): Counter resets taken.
- `tick` (`() => PerfSample`): Emits the next generated sample to every watcher.
- `watchers` (`() => number`): How many watchers are open.

Source: [ui/src/settings/headless/fixture-performance.ts:41](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-performance.ts#L41)

### `FixturePerformanceOptions`

Interface.

Options for [`createFixturePerformanceHost`](https://zidane.si/docs/reference/ui-settings-testing.md#createFixturePerformanceHost).

```ts
interface FixturePerformanceOptions
```

**Properties**

- `history?` (`number`): Samples already held. Default: 30, ending now.
- `intervalMs?` (`number`): Milliseconds between samples while watched; `0` never ticks (tests drive `control.tick`). Default 2000.
- `profileBusy?` (`boolean`): Profiles answer `busy`. Default: false.
- `profileOutcome?` (`PerfProfileOutcome`): What `profile` answers, instead of the generated profile.
- `reportPath?` (`string`): Where `exportReport` says it wrote.
- `samples?` (`PerfSample[]`): The history held, instead of the generated one.
- `threads?` (`Record<number, PerfOsThread[]>`): What `threads(pid)` answers per pid, instead of a generic list.
- `watchError?` (`PerfWatchError`): Every watch fails with this (a server too old, a token without admin): no samples follow.

Source: [ui/src/settings/headless/fixture-performance.ts:21](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-performance.ts#L21)

### `FixtureSettingsAccounts`

Interface.

The groups and their control.

```ts
interface FixtureSettingsAccounts
```

**Properties**

- `control` (`FixtureSettingsAccountsControl`): Reads what the groups hold and finishes their sign-ins.
- `mcp?` (`SettingsMcpHost`): The `mcp` group, when `data.mcp` was given.
- `providers?` (`SettingsProvidersHost`): The `providers` group, when `data.providers` was given.

Source: [ui/src/settings/headless/fixture-accounts.ts:48](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-accounts.ts#L48)

### `FixtureSettingsAccountsControl`

Interface.

Reads what the fixture holds and finishes its sign-ins.

```ts
interface FixtureSettingsAccountsControl
```

**Properties**

- `finishSignIn` (`() => void`): Finishes every sign-in that waits for its browser.
- `providers` (`() => readonly SettingsProvider[]`): The providers held now.
- `restarts` (`() => readonly string[]`): The servers restarted, in order.
- `servers` (`() => readonly SettingsMcpServer[]`): The MCP servers held now.

Source: [ui/src/settings/headless/fixture-accounts.ts:36](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-accounts.ts#L36)

### `FixtureSettingsAccountsData`

Interface.

What the fixture's Accounts and MCP servers hold. Each key offers its group.

```ts
interface FixtureSettingsAccountsData
```

**Properties**

- `mcp?` (`readonly SettingsMcpServer[]`): The MCP servers (offers `mcp`).
- `mcpInstances?` (`readonly SettingsMcpInstance[]`): Their running processes (offers `mcp.instances` and `mcp.restart`).
- `providers?` (`readonly SettingsProvider[]`): The providers (offers `providers`).
- `signInMs?` (`number`): A sign-in finishes on its own after this many ms. Default: only on `control.finishSignIn()`.
- `signInUrl?` (`string`): The address a sign-in opens. Default: `https://example.com/sign-in`.

Source: [ui/src/settings/headless/fixture-accounts.ts:22](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-accounts.ts#L22)

### `FixtureSettingsControl`

Interface.

Changes the fixture's stored settings from outside.

```ts
interface FixtureSettingsControl
```

**Properties**

- `accounts` (`FixtureSettingsAccountsControl`): Accounts' providers and MCP servers' servers, and their sign-ins.
- `performance` (`FixturePerformanceControl | null`): The performance member's control (`null` without `options.performance`).
- `sections` (`FixtureSettingsSectionsControl`): The catalog and diagnostics sections' data and what their actions did.
- `claudeImports` (`() => SettingsClaudeImportSelection[]`): The Claude Code imports run, in order.
- `refuse` (`(next: boolean) => void`): Refuse (`true`) or take (`false`) the next writes.
- `store` (`(patch: Partial<Settings>) => void`): Another writer changed the stored settings; the host reads them on its next `refresh`.
- `stored` (`() => Settings`): The settings stored now.
- `unreadable` (`(next: boolean) => void`): Make reads fail (`true`) or succeed (`false`).

Source: [ui/src/settings/headless/fixture-host.ts:58](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-host.ts#L58)

### `FixtureSettingsModelsData`

Interface.

The fixture's model data; each key offers its member of `models`.

```ts
interface FixtureSettingsModelsData
```

**Properties**

- `decisionModels?` (`SettingsDecisionModel[]`): The decision models (for every folder).
- `lastUsed?` (`ModelPickRef | null`): The last model picked (`null`: none).
- `tests?` (`Record<string, SettingsModelTest>`): How a test of each model goes, by model setting; a model left out fails as `unavailable`. Offers `test` and `testDecision`.

Source: [ui/src/settings/headless/fixture-models.ts:12](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-models.ts#L12)

### `FixtureSettingsOptions`

Interface.

Options for [`createFixtureSettingsHost`](https://zidane.si/docs/reference/ui-settings-testing.md#createFixtureSettingsHost).

```ts
interface FixtureSettingsOptions
```

**Properties**

- `accounts?` (`FixtureSettingsAccountsData`): Accounts' providers and MCP servers' servers; each key offers its group.
- `claudeImport?` (`{ detect: SettingsClaudeImportDetect; summary: SettingsClaudeImportSummary }`): What `~/.claude` holds and what an import answers; offers `claudeImport`.
- `models?` (`FixtureSettingsModelsData`): The model rows' decision models, tests and last used model; each key offers its member of `models`.
- `performance?` (`FixturePerformanceOptions`): Offers `performance`: a believable app whose figures drift while watched.
- `readOnly?` (`boolean`): Leave `update` out: every row read-only. Default: false.
- `sections?` (`FixtureSettingsSectionsData`): The catalog and diagnostics sections' data (skills, extensions, plugins, …); each key offers its group.
- `unreadable?` (`boolean`): The settings can't be read: `document` lands on an error. Default: false.
- `values?` (`Partial<Settings>`): The stored settings over `DEFAULT_SETTINGS`.
- `writable?` (`boolean`): Offer `writable` with this value (a connection that may or may not write). Default: not offered.

Source: [ui/src/settings/headless/fixture-host.ts:36](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-host.ts#L36)

### `FixtureSettingsSections`

Interface.

The members and their control.

```ts
interface FixtureSettingsSections
```

**Properties**

- `control` (`FixtureSettingsSectionsControl`): Reads and changes what they hold.
- `environments?` (`SettingsEnvironmentsHost`): Over `environments`.
- `extensions?` (`SettingsExtensionsHost`): Over `extensions`.
- `hostCatalog?` (`SettingsHostCatalog`): Over `hostCatalog`.
- `instructions?` (`SettingsInstructionsHost`): Over `instructions`.
- `logs?` (`SettingsLogsHost`): Over `logs`.
- `plugins?` (`SettingsPluginsHost`): Over `plugins`.
- `skills?` (`SettingsSkillsHost`): Over `skills` (and `skillSources`).

Source: [ui/src/settings/headless/fixture-sections.ts:104](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-sections.ts#L104)

### `FixtureSettingsSectionsControl`

Interface.

Changes the fixture's catalogs from outside and reads what actions did.

```ts
interface FixtureSettingsSectionsControl
```

**Properties**

- `catalogChanged` (`(kind: SettingsCatalogKind) => void`): A host catalog changed there: `hostCatalog.onChanged` listeners hear it.
- `data` (`() => FixtureSettingsSectionsData`): What the fixture holds now.
- `environmentChanges` (`() => readonly EnvironmentSettingsChange[]`): Environment edits applied, in order.
- `log` (`(record: LogRecord) => void`): A new log record, told to followers.
- `overrides` (`() => readonly string[]`): System overrides created, by session.

Source: [ui/src/settings/headless/fixture-sections.ts:90](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-sections.ts#L90)

### `FixtureSettingsSectionsData`

Interface.

What the fixture's catalog and diagnostics members hold. Each key offers its group.

```ts
interface FixtureSettingsSectionsData
```

**Properties**

- `environments?` (`EnvironmentDescriptor[]`): The environment kinds.
- `extensionOptions?` (`FixtureExtensionOptions`): The options and actions the enabled extensions declare (with `extensions`); each key offers its member.
- `extensions?` (`SettingsExtension[]`): The extensions (for every folder).
- `extensionSources?` (`Record<string, ExtensionSourceListing>`): What a source spec lists, for the extensions browser (with `extensions`, and with `hostCatalog`
  its browser and Change origin). An unlisted spec
  answers a `not-found` listing. `changeOrigin` moves an extension to a listed source holding its
  name, else fails as the installer does (`name-mismatch`, naming what it found).
- `hostCatalog?` (`FixtureHostCatalogs | null`): A host's catalogs (`null`: the host can't list them).
- `hostInstallFailures?` (`Record<string, string>`): Host installs that fail, by spec: the error each rejects with.
- `hostInstalls?` (`boolean`): The host takes installs from this connection. Default: true.
- `instructions?` (`Record<string, ContextSegmentsReport | null>`): Each session's prompt (`null`: no live agent).
- `logs?` (`LogRecord[]`): The log records held.
- `plugins?` (`SettingsPlugin[]`): The plugins (for every folder).
- `skills?` (`SkillConfig[]`): The skills (for every folder); their `instructions` are their SKILL.md bodies.
- `skillSources?` (`Record<string, SkillSourceListing>`): What a source spec lists, for the skills browser.

Source: [ui/src/settings/headless/fixture-sections.ts:57](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-sections.ts#L57)

## Types

### `FixturePerformanceHost`

Type.

The fixture member and its control.

```ts
type FixturePerformanceHost = SettingsPerformanceHost & { control: FixturePerformanceControl }
```

Source: [ui/src/settings/headless/fixture-performance.ts:55](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-performance.ts#L55)

### `FixtureSettingsHost`

Type.

A fixture settings host and its control.

```ts
type FixtureSettingsHost = SettingsHost & { control: FixtureSettingsControl }
```

Source: [ui/src/settings/headless/fixture-host.ts:78](https://github.com/Tahul/zidane/blob/main/ui/src/settings/headless/fixture-host.ts#L78)
