import { Readable, Writable } from "node:stream"; import type { CommonArgs } from "./commonArgs"; import type { CommandDeps } from "./types"; import type { LoadResult, StoredEntry, TokenStore } from "../oauth/tokenStore"; import type { TokenSet } from "../oauth/tokenResponse"; /** A `Writable` that accumulates everything written into a string. */ export interface CapturedStream extends Writable { /** Concatenation of every chunk written to the stream so far. */ readonly value: string; } /** * Returns a `Writable` that records every write into a string for * assertion. Reads via `.value`. Defined as a real `Writable` * subclass so it can be passed straight into `CommandDeps.stdout` / * `CommandDeps.stderr` without casts. */ export declare function captureStream(): CapturedStream; /** Convenience: an empty `Readable` to stand in for stdin in tests. */ export declare function emptyStdin(): Readable; /** A `TokenStore` plus instrumentation for assertions. */ export interface FakeStore extends TokenStore { /** Number of times `load()` was called. */ readonly loadedTimes: number; /** Number of times `clear()` was called. */ readonly clearedTimes: number; /** Current state, observable from tests. */ readonly current: LoadResult; } /** * In-memory `TokenStore` that starts in `initial`, accepts * `save()` / `clear()`, and exposes `loadedTimes` / `clearedTimes` * / `current` for assertions. */ export declare function makeStore(initial: LoadResult): FakeStore; /** * Builds a `StoredEntry` for the standard test issuer/client. Pass a * `TokenSet` (from a per-test fixture) and override the * issuer/client/insecure fields when a test cares about them. */ export declare function entry(tokens: TokenSet, overrides?: Partial>): StoredEntry; /** A `CommandDeps` shape with the captured streams exposed. */ export interface CapturedDeps extends CommandDeps { stdout: CapturedStream; stderr: CapturedStream; } /** Returns a `CommandDeps` populated with capturing streams. */ export declare function captureDeps(overrides?: Partial): CapturedDeps; /** * Returns a fully-resolved `CommonArgs` for the standard test * issuer/client. Override individual fields as needed. */ export declare function commonArgs(overrides?: Partial): CommonArgs;