zidane-ui/ files/ testing
import { … } from 'zidane-ui/files/testing'ui/src/files/testing/index.ts
Functions#
createFixtureFilesHostFunction#
An in-memory FilesHost: list, read, write (version-guarded), search, git status, the working-tree diff,
watch and editor preferences. No diagnostics, language servers, system actions or media addresses.
function createFixtureFilesHost(options?: FixtureFilesHostOptions): FixtureFilesHostParameters
| Name | Type | Default | Description |
|---|---|---|---|
| options? | FixtureFilesHostOptions | {} | The files, the git status and the patches it starts with. |
Returns
memoryEntryPortFunction#
An EntryPort over the fixture's memory: files by path, made folders, a version clock. Also a fake backend's (tests).
function memoryEntryPort(
files: Map<string, { text: string; version: number }>,
dirs: Set<string>,
tick: () => number,
): EntryPortParameters
| Name | Type | Description |
|---|---|---|
| files | Map<string, { text: string; version: number }> | The files, by path, with their text and version. |
| dirs | Set<string> | The folders made with no file in them yet. |
| tick | () => number | The next version number. |
Returns
EntryPortConstants#
DEMO_FILESConstant#
The demo folder's files, its git status and its working-tree patches.
const DEMO_FILES: Required<FixtureFilesHostOptions>Interfaces#
FixtureFilesControlInterface#
Changes the fixture from outside.
interface FixtureFilesControlProperties
| Name | Type | Description |
|---|---|---|
| edit | (path: string, text: string) => void | Another writer changed (or created) a file: its version moves. |
| emptyDirs | () => string[] | The empty folders now. |
| file | (path: string) => string | undefined | A file's text now, or |
| setDiff | (diff: string) => void | Sets the working-tree patch. |
| setStatus | (status: readonly GitStatusEntry[]) => void | Sets the git status. |
| touch | (why?: FolderChange) => void | The folder may have changed: every watcher hears |
FixtureFilesHostOptionsInterface#
Options of createFixtureFilesHost.
interface FixtureFilesHostOptionsProperties
| Name | Type | Description |
|---|---|---|
| diff? | string | Its working tree against HEAD, as a unified patch. Default: empty. |
| fileDiffs? | Readonly<Record<string, string>> | Per-file patches for |
| files? | Readonly<Record<string, string>> | The folder's text files, by path relative to it. |
| status? | readonly GitStatusEntry[] | Its git status. Default: none. |
Types#
FixtureFilesHostType#
The fixture host, with its FixtureFilesControl.
type FixtureFilesHost = FilesHost & { control: FixtureFilesControl }