1 | ;
|
2 | /**
|
3 | * @license
|
4 | * Copyright Google LLC All Rights Reserved.
|
5 | *
|
6 | * Use of this source code is governed by an MIT-style license that can be
|
7 | * found in the LICENSE file at https://angular.io/license
|
8 | */
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.test = void 0;
|
11 | const path_1 = require("../path");
|
12 | const buffer_1 = require("./buffer");
|
13 | const memory_1 = require("./memory");
|
14 | const sync_1 = require("./sync");
|
15 | // eslint-disable-next-line @typescript-eslint/no-namespace
|
16 | var test;
|
17 | (function (test) {
|
18 | class TestHost extends memory_1.SimpleMemoryHost {
|
19 | constructor(map = {}) {
|
20 | super();
|
21 | this._records = [];
|
22 | this._sync = null;
|
23 | for (const filePath of Object.getOwnPropertyNames(map)) {
|
24 | this._write((0, path_1.normalize)(filePath), (0, buffer_1.stringToFileBuffer)(map[filePath]));
|
25 | }
|
26 | }
|
27 | get records() {
|
28 | return [...this._records];
|
29 | }
|
30 | clearRecords() {
|
31 | this._records = [];
|
32 | }
|
33 | get files() {
|
34 | const sync = this.sync;
|
35 | function _visit(p) {
|
36 | return sync
|
37 | .list(p)
|
38 | .map((fragment) => (0, path_1.join)(p, fragment))
|
39 | .reduce((files, path) => {
|
40 | if (sync.isDirectory(path)) {
|
41 | return files.concat(_visit(path));
|
42 | }
|
43 | else {
|
44 | return files.concat(path);
|
45 | }
|
46 | }, []);
|
47 | }
|
48 | return _visit((0, path_1.normalize)('/'));
|
49 | }
|
50 | get sync() {
|
51 | if (!this._sync) {
|
52 | this._sync = new sync_1.SyncDelegateHost(this);
|
53 | }
|
54 | return this._sync;
|
55 | }
|
56 | clone() {
|
57 | const newHost = new TestHost();
|
58 | newHost._cache = new Map(this._cache);
|
59 | return newHost;
|
60 | }
|
61 | // Override parents functions to keep a record of all operators that were done.
|
62 | _write(path, content) {
|
63 | this._records.push({ kind: 'write', path });
|
64 | return super._write(path, content);
|
65 | }
|
66 | _read(path) {
|
67 | this._records.push({ kind: 'read', path });
|
68 | return super._read(path);
|
69 | }
|
70 | _delete(path) {
|
71 | this._records.push({ kind: 'delete', path });
|
72 | return super._delete(path);
|
73 | }
|
74 | _rename(from, to) {
|
75 | this._records.push({ kind: 'rename', from, to });
|
76 | return super._rename(from, to);
|
77 | }
|
78 | _list(path) {
|
79 | this._records.push({ kind: 'list', path });
|
80 | return super._list(path);
|
81 | }
|
82 | _exists(path) {
|
83 | this._records.push({ kind: 'exists', path });
|
84 | return super._exists(path);
|
85 | }
|
86 | _isDirectory(path) {
|
87 | this._records.push({ kind: 'isDirectory', path });
|
88 | return super._isDirectory(path);
|
89 | }
|
90 | _isFile(path) {
|
91 | this._records.push({ kind: 'isFile', path });
|
92 | return super._isFile(path);
|
93 | }
|
94 | _stat(path) {
|
95 | this._records.push({ kind: 'stat', path });
|
96 | return super._stat(path);
|
97 | }
|
98 | _watch(path, options) {
|
99 | this._records.push({ kind: 'watch', path });
|
100 | return super._watch(path, options);
|
101 | }
|
102 | $write(path, content) {
|
103 | return super._write((0, path_1.normalize)(path), (0, buffer_1.stringToFileBuffer)(content));
|
104 | }
|
105 | $read(path) {
|
106 | return (0, buffer_1.fileBufferToString)(super._read((0, path_1.normalize)(path)));
|
107 | }
|
108 | $list(path) {
|
109 | return super._list((0, path_1.normalize)(path));
|
110 | }
|
111 | $exists(path) {
|
112 | return super._exists((0, path_1.normalize)(path));
|
113 | }
|
114 | $isDirectory(path) {
|
115 | return super._isDirectory((0, path_1.normalize)(path));
|
116 | }
|
117 | $isFile(path) {
|
118 | return super._isFile((0, path_1.normalize)(path));
|
119 | }
|
120 | }
|
121 | test.TestHost = TestHost;
|
122 | })(test || (exports.test = test = {}));
|
123 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2FuZ3VsYXJfZGV2a2l0L2Nv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