zidane-ui/ palette/ testing/ contract
import { … } from 'zidane-ui/palette/testing/contract'ui/src/palette/testing/contract.ts
Functions#
describePaletteHostContractFunction#
Declares the shared PaletteHost suite for one implementation.
function describePaletteHostContract(
name: string,
makeHarness: PaletteHostHarnessFactory,
capabilities: readonly PaletteHostCapability[],
): voidParameters
| Name | Type | Description |
|---|---|---|
| name | string | The implementation's name, shown in the suite title. |
| makeHarness | PaletteHostHarnessFactory | Builds a fresh host over a backend that holds what it is given, once per test. |
| capabilities | readonly PaletteHostCapability[] | The optional members the host offers. Every other optional member must be undefined. |
Interfaces#
PaletteHostContractBackendInterface#
What the backend behind the host holds.
interface PaletteHostContractBackendProperties
| Name | Type | Description |
|---|---|---|
| commands | readonly PaletteCommand[] | The |
| conversations | Readonly<Record<string, string>> | Each session's conversation text, by session id (what a content search scans). |
| cwd | string | The project folder (the commands' |
| extensionFailing | { itemId: string; message: string } | What running an extension item does: a notice with its id, or a failure with this message for |
| extensionItems | readonly PaletteItem[] | Extension items for |
| files | readonly string[] | The files under |
| sessionId | string | A session in that folder (hosts that list a session's workspace list it through this one). |
| settings | Partial<Settings> | The settings in effect. Writes land here. |
PaletteHostHarnessInterface#
A host built over a backend, and what the suite drives on it.
interface PaletteHostHarnessProperties
| Name | Type | Description |
|---|---|---|
| host | PaletteHost | The host under test. |
| changeExtensions? | () => void | Has the backend announce that the extension items changed (needed for |
| dispose? | () => void | Closes connections and timers after each test. |
Types#
PaletteHostCapabilityType#
An optional PaletteHost member, by its path.
type PaletteHostCapability =
| 'listCommands'
| 'listFiles'
| 'extensions'
| 'extensions.subscribe'
| 'settings'
| 'setSettings'
| 'recents'
| 'searchConversations'PaletteHostHarnessFactoryType#
Builds a fresh host (and its backend) for one test.
type PaletteHostHarnessFactory = (backend: PaletteHostContractBackend) => PaletteHostHarness | Promise<PaletteHostHarness>