UNPKG

1.83 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.dev/license
7 */
8import { Observable } from 'rxjs';
9import { Path, PathFragment } from '../path';
10import { FileBuffer, HostWatchEvent, HostWatchOptions, Stats } from './interface';
11import { SimpleMemoryHost, SimpleMemoryHostStats } from './memory';
12import { SyncDelegateHost } from './sync';
13export type TestLogRecord = {
14 kind: 'write' | 'read' | 'delete' | 'list' | 'exists' | 'isDirectory' | 'isFile' | 'stat' | 'watch';
15 path: Path;
16} | {
17 kind: 'rename';
18 from: Path;
19 to: Path;
20};
21export declare class TestHost extends SimpleMemoryHost {
22 protected _records: TestLogRecord[];
23 protected _sync: SyncDelegateHost<{}> | null;
24 constructor(map?: {
25 [path: string]: string;
26 });
27 get records(): TestLogRecord[];
28 clearRecords(): void;
29 get files(): Path[];
30 get sync(): SyncDelegateHost<{}>;
31 clone(): TestHost;
32 protected _write(path: Path, content: FileBuffer): void;
33 protected _read(path: Path): ArrayBuffer;
34 protected _delete(path: Path): void;
35 protected _rename(from: Path, to: Path): void;
36 protected _list(path: Path): PathFragment[];
37 protected _exists(path: Path): boolean;
38 protected _isDirectory(path: Path): boolean;
39 protected _isFile(path: Path): boolean;
40 protected _stat(path: Path): Stats<SimpleMemoryHostStats> | null;
41 protected _watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent>;
42 $write(path: string, content: string): void;
43 $read(path: string): string;
44 $list(path: string): PathFragment[];
45 $exists(path: string): boolean;
46 $isDirectory(path: string): boolean;
47 $isFile(path: string): boolean;
48}