UNPKG

1.99 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.io/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 declare namespace test {
14 type TestLogRecord = {
15 kind: 'write' | 'read' | 'delete' | 'list' | 'exists' | 'isDirectory' | 'isFile' | 'stat' | 'watch';
16 path: Path;
17 } | {
18 kind: 'rename';
19 from: Path;
20 to: Path;
21 };
22 class TestHost extends SimpleMemoryHost {
23 protected _records: TestLogRecord[];
24 protected _sync: SyncDelegateHost<{}> | null;
25 constructor(map?: {
26 [path: string]: string;
27 });
28 get records(): TestLogRecord[];
29 clearRecords(): void;
30 get files(): Path[];
31 get sync(): SyncDelegateHost<{}>;
32 clone(): TestHost;
33 protected _write(path: Path, content: FileBuffer): void;
34 protected _read(path: Path): ArrayBuffer;
35 protected _delete(path: Path): void;
36 protected _rename(from: Path, to: Path): void;
37 protected _list(path: Path): PathFragment[];
38 protected _exists(path: Path): boolean;
39 protected _isDirectory(path: Path): boolean;
40 protected _isFile(path: Path): boolean;
41 protected _stat(path: Path): Stats<SimpleMemoryHostStats> | null;
42 protected _watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent>;
43 $write(path: string, content: string): void;
44 $read(path: string): string;
45 $list(path: string): PathFragment[];
46 $exists(path: string): boolean;
47 $isDirectory(path: string): boolean;
48 $isFile(path: string): boolean;
49 }
50}