zidane-ui/ settings/ testing/ contract
import { … } from 'zidane-ui/settings/testing/contract'ui/src/settings/testing/contract.ts
Functions#
describeSettingsAccountsContractFunction#
Declares the shared suite of the providers and mcp groups for one implementation.
function describeSettingsAccountsContract(
name: string,
makeHarness: SettingsAccountsHarnessFactory,
capabilities: readonly SettingsAccountsCapability[],
): voidParameters
| Name | Type | Description |
|---|---|---|
| name | string | The implementation's name, shown in the suite title. |
| makeHarness | SettingsAccountsHarnessFactory | Builds a fresh host over a backend that holds what it is given, once per test. |
| capabilities | readonly SettingsAccountsCapability[] | The groups and actions the host offers. Every other one must be undefined. |
describeSettingsClaudeImportContractFunction#
Declares the shared SettingsHost.claudeImport suite for one implementation.
function describeSettingsClaudeImportContract(
name: string,
makeHarness: SettingsClaudeImportHarnessFactory,
offered: boolean,
): voidParameters
| Name | Type | Description |
|---|---|---|
| name | string | The implementation's name, shown in the suite title. |
| makeHarness | SettingsClaudeImportHarnessFactory | Builds a fresh host over a backend that holds what it is given, once per test. |
| offered | boolean | Whether the host offers |
describeSettingsExtensionOptionsContractFunction#
Declares the shared extension options suite for one implementation.
function describeSettingsExtensionOptionsContract(
name: string,
makeHarness: SettingsExtensionOptionsHarnessFactory,
capabilities: readonly SettingsExtensionOptionsCapability[],
): voidParameters
| Name | Type | Description |
|---|---|---|
| name | string | The implementation's name, shown in the suite title. |
| makeHarness | SettingsExtensionOptionsHarnessFactory | Builds a fresh host over a backend that holds what it is given, once per test. |
| capabilities | readonly SettingsExtensionOptionsCapability[] | The members the host offers. Every other one must be undefined. |
describeSettingsHostContractFunction#
Declares the shared SettingsHost suite for one implementation.
function describeSettingsHostContract(
name: string,
makeHarness: SettingsHostHarnessFactory,
capabilities: readonly SettingsHostCapability[],
traits?: SettingsHostContractTraits,
): voidParameters
| Name | Type | Default | Description |
|---|---|---|---|
| name | string | The implementation's name, shown in the suite title. | |
| makeHarness | SettingsHostHarnessFactory | Builds a fresh host over a backend that holds what it is given, once per test. | |
| capabilities | readonly SettingsHostCapability[] | The optional members the host offers. Every other optional member must be undefined. | |
| traits? | SettingsHostContractTraits | {} | The failures the backend can stage. |
describeSettingsModelsContractFunction#
Declares the shared SettingsHost.models suite for one implementation.
function describeSettingsModelsContract(
name: string,
makeHarness: SettingsModelsHarnessFactory,
capabilities: readonly SettingsModelsCapability[],
): voidParameters
| Name | Type | Description |
|---|---|---|
| name | string | The implementation's name, shown in the suite title. |
| makeHarness | SettingsModelsHarnessFactory | Builds a fresh host over a backend that holds what it is given, once per test. |
| capabilities | readonly SettingsModelsCapability[] | The members of |
describeSettingsPerformanceContractFunction#
Declares the shared SettingsHost.performance suite for one implementation.
function describeSettingsPerformanceContract(
name: string,
makeHarness: SettingsPerformanceHarnessFactory,
capabilities: false | readonly SettingsPerformanceCapability[],
options?: SettingsPerformanceContractOptions,
): voidParameters
| Name | Type | Default | Description |
|---|---|---|---|
| name | string | The implementation's name, shown in the suite title. | |
| makeHarness | SettingsPerformanceHarnessFactory | Builds a fresh host over a backend that holds what it is given, once per test. | |
| capabilities | false | readonly SettingsPerformanceCapability[] | The optional members the host offers; | |
| options? | SettingsPerformanceContractOptions | {} | What else to check (refused watches). |
describeSettingsSectionsContractFunction#
Declares the shared suite of the catalog and diagnostics groups for one implementation.
function describeSettingsSectionsContract(
name: string,
makeHarness: SettingsSectionsHarnessFactory,
capabilities: readonly SettingsSectionsCapability[],
): voidParameters
| Name | Type | Description |
|---|---|---|
| name | string | The implementation's name, shown in the suite title. |
| makeHarness | SettingsSectionsHarnessFactory | Builds a fresh host over a backend that holds what it is given, once per test. |
| capabilities | readonly SettingsSectionsCapability[] | The groups the host offers. Every other group must be undefined. |
Constants#
ACCOUNTS_CONTRACT_CWDConstant#
The folder the suite's MCP calls name.
const ACCOUNTS_CONTRACT_CWD = '/work/app'Interfaces#
SettingsAccountsBackendInterface#
What the backend behind the host holds.
interface SettingsAccountsBackendProperties
| Name | Type | Description |
|---|---|---|
| instances | SettingsMcpInstance[] | The running processes of those servers. |
| providers | SettingsProvider[] | The providers and their credentials. |
| servers | SettingsMcpServer[] | The MCP servers of the folder the suite names ( |
SettingsAccountsControlInterface#
Reads the backend and acts on it from outside.
interface SettingsAccountsControlProperties
| Name | Type | Description |
|---|---|---|
| credentials | (provider: string) => readonly SettingsCredential[] | The stored credentials of a provider now (no |
| finishSignIn | () => void | Promise<void> | The browser of the sign-in that waits came back: it finishes. |
| restarts? | () => readonly string[] | The servers restarted, in order. Required with |
| serverNames | () => string[] | The servers held now, by name. |
SettingsAccountsHarnessInterface#
A host built over a backend, its control, and how to tear them down.
interface SettingsAccountsHarnessProperties
| Name | Type | Description |
|---|---|---|
| control | SettingsAccountsControl | Reads and acts on the backend. |
| host | SettingsHost | The host under test. |
| dispose? | () => void | Closes listeners after each test. |
SettingsClaudeImportBackendInterface#
What the backend behind the host holds.
interface SettingsClaudeImportBackendProperties
| Name | Type | Description |
|---|---|---|
| detect | SettingsClaudeImportDetect | What |
| summary | SettingsClaudeImportSummary | What an import answers. |
SettingsClaudeImportHarnessInterface#
A host built over a backend, and how to tear it down.
interface SettingsClaudeImportHarnessProperties
| Name | Type | Description |
|---|---|---|
| host | SettingsHost | The host under test. |
| dispose? | () => void | Closes listeners after each test. |
| runs? | () => SettingsClaudeImportSelection[] | The selections the backend imported, in order. |
SettingsExtensionOptionsBackendInterface#
What the backend behind the host holds.
interface SettingsExtensionOptionsBackendProperties
| Name | Type | Description |
|---|---|---|
| actions | SettingsExtensionAction[] | The action rows declared. |
| runs | Record<string, SettingsExtensionActionResult> | What running each action answers, keyed |
| schema | WireExtensionConfigSchema | The options declared (for every folder). |
| statuses | Record<string, SettingsExtensionActionStatus> | The probes, keyed |
SettingsExtensionOptionsHarnessInterface#
A host built over a backend, and how to tear it down.
interface SettingsExtensionOptionsHarnessProperties
| Name | Type | Description |
|---|---|---|
| host | SettingsHost | The host under test. |
| created? | () => string[] | The extensions scaffolded, by name. |
| dispose? | () => void | Closes listeners after each test. |
SettingsHostContractBackendInterface#
What the backend behind the host holds.
interface SettingsHostContractBackendProperties
| Name | Type | Description |
|---|---|---|
| unreadable | boolean | Reads fail. |
| values | Partial<Settings> | The stored settings (a partial document: the host fills the rest from |
| writable | boolean | This connection may write. |
SettingsHostContractControlInterface#
Reads the backend and changes it from outside.
interface SettingsHostContractControlProperties
| Name | Type | Description |
|---|---|---|
| refuse? | (next: boolean) => void | Refuse the next writes ( |
| store | (patch: Partial<Settings>) => void | Another writer changed the stored settings. The host shows them after its next |
| stored | () => Partial<Settings> | The settings stored now. |
SettingsHostContractTraitsInterface#
Failures the backend can stage. Default: both.
interface SettingsHostContractTraitsProperties
| Name | Type | Description |
|---|---|---|
| failedRead? | boolean | A read can fail (the document lands on an error). |
| refusedWrite? | boolean | A write can be refused ( |
SettingsHostHarnessInterface#
A host built over a backend, the backend's control, and how to tear them down.
interface SettingsHostHarnessProperties
| Name | Type | Description |
|---|---|---|
| control | SettingsHostContractControl | Reads and changes the backend. |
| host | SettingsHost | The host under test. |
| dispose? | () => void | Closes listeners after each test. |
SettingsModelsBackendInterface#
What the backend behind the host holds.
interface SettingsModelsBackendProperties
| Name | Type | Description |
|---|---|---|
| decisionModels | SettingsDecisionModel[] | The decision models (for every folder). |
| lastUsed | ModelPickRef | null | The last model picked. |
| tests | Record<string, SettingsModelTest> | How a test of each model goes, by model setting ( |
SettingsModelsHarnessInterface#
A host built over a backend, and how to tear it down.
interface SettingsModelsHarnessProperties
| Name | Type | Description |
|---|---|---|
| host | SettingsHost | The host under test. |
| dispose? | () => void | Closes listeners after each test. |
SettingsPerformanceBackendInterface#
What the backend behind the host holds.
interface SettingsPerformanceBackendProperties
| Name | Type | Description |
|---|---|---|
| profile | PerfProfileOutcome | What a profile answers. |
| reportPath | string | Where a report is written. |
| samples | PerfSample[] | The samples held, oldest first. |
| threads | Record<number, PerfOsThread[]> | Each process's threads. |
| watchError? | PerfWatchError | Set: the backend refuses every watch with this (only with |
SettingsPerformanceContractOptionsInterface#
What the suite checks beyond the members.
interface SettingsPerformanceContractOptionsProperties
| Name | Type | Description |
|---|---|---|
| watchErrors? | boolean | The host can refuse a watch: build it over |
SettingsPerformanceControlInterface#
Drives the backend and reads it back.
interface SettingsPerformanceControlProperties
| Name | Type | Description |
|---|---|---|
| emit | (sample: PerfSample) => void | The backend takes a sample: every watcher gets it. |
| profiles | () => { seconds: number; target: PerfProfileTarget }[] | Profiles the backend recorded, in order. |
| resets | () => number | Counter resets the backend took. |
| watching | () => number | How many watches are open on the backend (it samples only while one is). |
SettingsPerformanceHarnessInterface#
A host built over a backend, its control, and how to tear them down.
interface SettingsPerformanceHarnessProperties
| Name | Type | Description |
|---|---|---|
| control | SettingsPerformanceControl | Drives the backend: pushes samples, fails calls. |
| host | SettingsHost | The host under test, its |
| dispose? | () => void | Tears the host down after the test. |
SettingsSectionsBackendInterface#
What the backend behind the host holds.
interface SettingsSectionsBackendProperties
| Name | Type | Description |
|---|---|---|
| environments | EnvironmentDescriptor[] | The environment kinds. |
| extensions | SettingsExtension[] | The extensions on disk (for every folder). |
| hostCatalog | FixtureHostCatalogs | null |
|
| instructions | Record<string, ContextSegmentsReport> | Each session's prompt. |
| logs | LogRecord[] | The log records held. |
| plugins | SettingsPlugin[] | The plugins (for every folder). |
| skills | SkillConfig[] | The skills on disk (for every folder). |
SettingsSectionsControlInterface#
Reads the backend and changes it from outside.
interface SettingsSectionsControlProperties
| Name | Type | Description |
|---|---|---|
| catalogChanged | (kind: SettingsCatalogKind) => void | One of the host's catalogs changed there (another client installed something). |
| environmentChanges | () => readonly EnvironmentSettingsChange[] | Environment edits the backend took, in order. |
| extensionNames | () => string[] | The extensions held now (by name). |
| log | (record: LogRecord) => void | The backend logs a record. |
| skillNames | () => string[] | The skills held now (by name). |
SettingsSectionsHarnessInterface#
A host built over a backend, its control, and how to tear them down.
interface SettingsSectionsHarnessProperties
| Name | Type | Description |
|---|---|---|
| control | SettingsSectionsControl | Reads and changes the backend. |
| host | SettingsHost | The host under test. |
| dispose? | () => void | Closes listeners after each test. |
Types#
SettingsAccountsCapabilityType#
A group of SettingsHost this suite covers, or one of its optional actions.
type SettingsAccountsCapability =
| 'providers'
| 'providers.setApiKey'
| 'providers.configure'
| 'providers.clear'
| 'providers.remove'
| 'providers.setPreferred'
| 'providers.rename'
| 'providers.signIn'
| 'mcp'
| 'mcp.test'
| 'mcp.signIn'
| 'mcp.signOut'
| 'mcp.add'
| 'mcp.remove'
| 'mcp.instances'
| 'mcp.restart'SettingsAccountsHarnessFactoryType#
Builds a fresh host (and its backend) for one test.
type SettingsAccountsHarnessFactory = (backend: SettingsAccountsBackend) => SettingsAccountsHarness | Promise<SettingsAccountsHarness>SettingsClaudeImportHarnessFactoryType#
Builds a fresh host (and its backend) for one test.
type SettingsClaudeImportHarnessFactory = (backend: SettingsClaudeImportBackend) => SettingsClaudeImportHarness | Promise<SettingsClaudeImportHarness>SettingsExtensionOptionsCapabilityType#
An extension options member of SettingsHost.extensions.
type SettingsExtensionOptionsCapability =
| 'configSchema'
| 'actions'
| 'actionStatuses'
| 'runAction'
| 'create'SettingsExtensionOptionsHarnessFactoryType#
Builds a fresh host (and its backend) for one test.
type SettingsExtensionOptionsHarnessFactory = (backend: SettingsExtensionOptionsBackend) => SettingsExtensionOptionsHarness | Promise<SettingsExtensionOptionsHarness>SettingsHostCapabilityType#
An optional SettingsHost member.
type SettingsHostCapability = 'update' | 'writable'SettingsHostHarnessFactoryType#
Builds a fresh host (and its backend) for one test.
type SettingsHostHarnessFactory = (backend: SettingsHostContractBackend) => SettingsHostHarness | Promise<SettingsHostHarness>SettingsModelsCapabilityType#
A member of SettingsHost.models.
type SettingsModelsCapability = 'decisionModels' | 'test' | 'testDecision' | 'lastUsed'SettingsModelsHarnessFactoryType#
Builds a fresh host (and its backend) for one test.
type SettingsModelsHarnessFactory = (backend: SettingsModelsBackend) => SettingsModelsHarness | Promise<SettingsModelsHarness>SettingsPerformanceCapabilityType#
An optional member of SettingsHost.performance.
type SettingsPerformanceCapability =
| 'threads'
| 'resetCounters'
| 'exportReport'
| 'profile'SettingsPerformanceHarnessFactoryType#
Builds a fresh host (and its backend) for one test.
type SettingsPerformanceHarnessFactory = (backend: SettingsPerformanceBackend) => SettingsPerformanceHarness | Promise<SettingsPerformanceHarness>SettingsSectionsCapabilityType#
A catalog or diagnostics group of SettingsHost.
type SettingsSectionsCapability =
| 'skills'
| 'extensions'
| 'plugins'
| 'instructions'
| 'environments'
| 'logs'
| 'hostCatalog'
| 'paths'SettingsSectionsHarnessFactoryType#
Builds a fresh host (and its backend) for one test.
type SettingsSectionsHarnessFactory = (backend: SettingsSectionsBackend) => SettingsSectionsHarness | Promise<SettingsSectionsHarness>