@jamesaphoenix/tx-test-utils 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database/index.d.ts +8 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +7 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/test-database.d.ts +101 -0
- package/dist/database/test-database.d.ts.map +1 -0
- package/dist/database/test-database.js +130 -0
- package/dist/database/test-database.js.map +1 -0
- package/dist/factories/anchor.factory.d.ts +117 -0
- package/dist/factories/anchor.factory.d.ts.map +1 -0
- package/dist/factories/anchor.factory.js +201 -0
- package/dist/factories/anchor.factory.js.map +1 -0
- package/dist/factories/candidate.factory.d.ts +151 -0
- package/dist/factories/candidate.factory.d.ts.map +1 -0
- package/dist/factories/candidate.factory.js +194 -0
- package/dist/factories/candidate.factory.js.map +1 -0
- package/dist/factories/edge.factory.d.ts +119 -0
- package/dist/factories/edge.factory.d.ts.map +1 -0
- package/dist/factories/edge.factory.js +191 -0
- package/dist/factories/edge.factory.js.map +1 -0
- package/dist/factories/factories.test.d.ts +8 -0
- package/dist/factories/factories.test.d.ts.map +1 -0
- package/dist/factories/factories.test.js +419 -0
- package/dist/factories/factories.test.js.map +1 -0
- package/dist/factories/index.d.ts +15 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories/index.js +21 -0
- package/dist/factories/index.js.map +1 -0
- package/dist/factories/learning.factory.d.ts +107 -0
- package/dist/factories/learning.factory.d.ts.map +1 -0
- package/dist/factories/learning.factory.js +150 -0
- package/dist/factories/learning.factory.js.map +1 -0
- package/dist/factories/task.factory.d.ts +106 -0
- package/dist/factories/task.factory.d.ts.map +1 -0
- package/dist/factories/task.factory.js +151 -0
- package/dist/factories/task.factory.js.map +1 -0
- package/dist/fixtures/index.d.ts +36 -0
- package/dist/fixtures/index.d.ts.map +1 -0
- package/dist/fixtures/index.js +47 -0
- package/dist/fixtures/index.js.map +1 -0
- package/dist/helpers/effect.d.ts +186 -0
- package/dist/helpers/effect.d.ts.map +1 -0
- package/dist/helpers/effect.js +298 -0
- package/dist/helpers/effect.js.map +1 -0
- package/dist/helpers/effect.test.d.ts +7 -0
- package/dist/helpers/effect.test.d.ts.map +1 -0
- package/dist/helpers/effect.test.js +271 -0
- package/dist/helpers/effect.test.js.map +1 -0
- package/dist/helpers/index.d.ts +7 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +11 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/llm-cache/cache.d.ts +152 -0
- package/dist/llm-cache/cache.d.ts.map +1 -0
- package/dist/llm-cache/cache.js +199 -0
- package/dist/llm-cache/cache.js.map +1 -0
- package/dist/llm-cache/cache.test.d.ts +7 -0
- package/dist/llm-cache/cache.test.d.ts.map +1 -0
- package/dist/llm-cache/cache.test.js +310 -0
- package/dist/llm-cache/cache.test.js.map +1 -0
- package/dist/llm-cache/cli.d.ts +113 -0
- package/dist/llm-cache/cli.d.ts.map +1 -0
- package/dist/llm-cache/cli.js +248 -0
- package/dist/llm-cache/cli.js.map +1 -0
- package/dist/llm-cache/index.d.ts +31 -0
- package/dist/llm-cache/index.d.ts.map +1 -0
- package/dist/llm-cache/index.js +31 -0
- package/dist/llm-cache/index.js.map +1 -0
- package/dist/mocks/anthropic.mock.d.ts +173 -0
- package/dist/mocks/anthropic.mock.d.ts.map +1 -0
- package/dist/mocks/anthropic.mock.js +125 -0
- package/dist/mocks/anthropic.mock.js.map +1 -0
- package/dist/mocks/ast-grep.mock.d.ts +216 -0
- package/dist/mocks/ast-grep.mock.d.ts.map +1 -0
- package/dist/mocks/ast-grep.mock.js +164 -0
- package/dist/mocks/ast-grep.mock.js.map +1 -0
- package/dist/mocks/file-system.mock.d.ts +181 -0
- package/dist/mocks/file-system.mock.d.ts.map +1 -0
- package/dist/mocks/file-system.mock.js +280 -0
- package/dist/mocks/file-system.mock.js.map +1 -0
- package/dist/mocks/index.d.ts +10 -0
- package/dist/mocks/index.d.ts.map +1 -0
- package/dist/mocks/index.js +16 -0
- package/dist/mocks/index.js.map +1 -0
- package/dist/mocks/mocks.test.d.ts +10 -0
- package/dist/mocks/mocks.test.d.ts.map +1 -0
- package/dist/mocks/mocks.test.js +961 -0
- package/dist/mocks/mocks.test.js.map +1 -0
- package/dist/mocks/openai.mock.d.ts +205 -0
- package/dist/mocks/openai.mock.d.ts.map +1 -0
- package/dist/mocks/openai.mock.js +178 -0
- package/dist/mocks/openai.mock.js.map +1 -0
- package/dist/setup/index.d.ts +7 -0
- package/dist/setup/index.d.ts.map +1 -0
- package/dist/setup/index.js +9 -0
- package/dist/setup/index.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock FileSystemService for testing.
|
|
3
|
+
*
|
|
4
|
+
* Provides configurable mock FileSystemService with in-memory storage,
|
|
5
|
+
* initial file fixtures, and failure injection for testing services
|
|
6
|
+
* that depend on file system operations.
|
|
7
|
+
*
|
|
8
|
+
* Note: Uses inline types until FileSystemService is exported from @tx/core.
|
|
9
|
+
*
|
|
10
|
+
* @module @tx/test-utils/mocks/file-system
|
|
11
|
+
*/
|
|
12
|
+
import { Context, Effect, Layer } from "effect";
|
|
13
|
+
import { Data } from "effect";
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Error Type
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Error type for file system operations.
|
|
19
|
+
*/
|
|
20
|
+
export class MockFileSystemError extends Data.TaggedError("FileSystemError") {
|
|
21
|
+
get message() {
|
|
22
|
+
return this.path
|
|
23
|
+
? `File system error at '${this.path}': ${this.reason}`
|
|
24
|
+
: `File system error: ${this.reason}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// Service Tag (mirrors FileSystemService from @tx/core)
|
|
29
|
+
// ============================================================================
|
|
30
|
+
/**
|
|
31
|
+
* Mock FileSystemService tag for dependency injection.
|
|
32
|
+
*/
|
|
33
|
+
export class MockFileSystemServiceTag extends Context.Tag("FileSystemService")() {
|
|
34
|
+
}
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Helpers
|
|
37
|
+
// ============================================================================
|
|
38
|
+
/**
|
|
39
|
+
* Get the parent directory path from a file path.
|
|
40
|
+
*/
|
|
41
|
+
const getParentDir = (path) => {
|
|
42
|
+
const normalized = path.replace(/\\/g, "/");
|
|
43
|
+
const lastSlash = normalized.lastIndexOf("/");
|
|
44
|
+
if (lastSlash <= 0)
|
|
45
|
+
return null;
|
|
46
|
+
return normalized.substring(0, lastSlash);
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Get the basename (file/dir name) from a path.
|
|
50
|
+
*/
|
|
51
|
+
const getBasename = (path) => {
|
|
52
|
+
const normalized = path.replace(/\\/g, "/");
|
|
53
|
+
const lastSlash = normalized.lastIndexOf("/");
|
|
54
|
+
return lastSlash === -1 ? normalized : normalized.substring(lastSlash + 1);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Extract all parent directories from a path.
|
|
58
|
+
*/
|
|
59
|
+
const extractParentDirs = (path) => {
|
|
60
|
+
const dirs = [];
|
|
61
|
+
let current = getParentDir(path);
|
|
62
|
+
while (current) {
|
|
63
|
+
dirs.push(current);
|
|
64
|
+
current = getParentDir(current);
|
|
65
|
+
}
|
|
66
|
+
return dirs;
|
|
67
|
+
};
|
|
68
|
+
// ============================================================================
|
|
69
|
+
// Factory
|
|
70
|
+
// ============================================================================
|
|
71
|
+
/**
|
|
72
|
+
* Create a mock FileSystemService for testing.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* // Basic usage - empty file system
|
|
77
|
+
* const mock = MockFileSystem()
|
|
78
|
+
* const program = Effect.gen(function* () {
|
|
79
|
+
* const fs = yield* MockFileSystemServiceTag
|
|
80
|
+
* yield* fs.writeFile("/tmp/test.txt", "hello")
|
|
81
|
+
* return yield* fs.readFile("/tmp/test.txt")
|
|
82
|
+
* })
|
|
83
|
+
* const result = await Effect.runPromise(Effect.provide(program, mock.layer))
|
|
84
|
+
* expect(result).toBe("hello")
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* // With initial files
|
|
90
|
+
* const mock = MockFileSystem({
|
|
91
|
+
* initialFiles: new Map([
|
|
92
|
+
* ["/app/config.json", '{"debug": true}'],
|
|
93
|
+
* ["/app/data.txt", "Hello World"]
|
|
94
|
+
* ])
|
|
95
|
+
* })
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* // With failure injection
|
|
101
|
+
* const mock = MockFileSystem({
|
|
102
|
+
* shouldFail: true,
|
|
103
|
+
* failureMessage: "Disk full"
|
|
104
|
+
* })
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* // With path-specific failures
|
|
110
|
+
* const mock = MockFileSystem({
|
|
111
|
+
* failuresByPath: new Map([
|
|
112
|
+
* ["/protected/secret.txt", "Permission denied"]
|
|
113
|
+
* ])
|
|
114
|
+
* })
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* // With operation-specific failures
|
|
120
|
+
* const mock = MockFileSystem({
|
|
121
|
+
* failuresByOperation: new Map([
|
|
122
|
+
* ["writeFile", "Read-only file system"]
|
|
123
|
+
* ])
|
|
124
|
+
* })
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export const MockFileSystem = (config = {}) => {
|
|
128
|
+
// Call tracking arrays
|
|
129
|
+
const readFileCalls = [];
|
|
130
|
+
const writeFileCalls = [];
|
|
131
|
+
const existsCalls = [];
|
|
132
|
+
const mkdirCalls = [];
|
|
133
|
+
const readdirCalls = [];
|
|
134
|
+
// In-memory storage
|
|
135
|
+
const files = new Map(config.initialFiles);
|
|
136
|
+
const directories = new Set(config.initialDirectories);
|
|
137
|
+
// Auto-create directories from initial files
|
|
138
|
+
if (config.initialFiles) {
|
|
139
|
+
for (const filePath of config.initialFiles.keys()) {
|
|
140
|
+
for (const dir of extractParentDirs(filePath)) {
|
|
141
|
+
directories.add(dir);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Store initial state for reset
|
|
146
|
+
const initialFiles = new Map(files);
|
|
147
|
+
const initialDirectories = new Set(directories);
|
|
148
|
+
/**
|
|
149
|
+
* Check for failure conditions.
|
|
150
|
+
*/
|
|
151
|
+
const checkFailure = (operation, path) => Effect.gen(function* () {
|
|
152
|
+
// Check for global failure
|
|
153
|
+
if (config.shouldFail) {
|
|
154
|
+
return yield* Effect.fail(new MockFileSystemError({
|
|
155
|
+
reason: config.failureMessage || "Mock FileSystem error",
|
|
156
|
+
path
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
// Check for operation-specific failure
|
|
160
|
+
const opFailure = config.failuresByOperation?.get(operation);
|
|
161
|
+
if (opFailure) {
|
|
162
|
+
return yield* Effect.fail(new MockFileSystemError({
|
|
163
|
+
reason: opFailure,
|
|
164
|
+
path
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
// Check for path-specific failure
|
|
168
|
+
if (path) {
|
|
169
|
+
const pathFailure = config.failuresByPath?.get(path);
|
|
170
|
+
if (pathFailure) {
|
|
171
|
+
return yield* Effect.fail(new MockFileSystemError({
|
|
172
|
+
reason: pathFailure,
|
|
173
|
+
path
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
const layer = Layer.succeed(MockFileSystemServiceTag, {
|
|
179
|
+
readFile: (path) => Effect.gen(function* () {
|
|
180
|
+
readFileCalls.push(path);
|
|
181
|
+
yield* checkFailure("readFile", path);
|
|
182
|
+
const content = files.get(path);
|
|
183
|
+
if (content === undefined) {
|
|
184
|
+
return yield* Effect.fail(new MockFileSystemError({
|
|
185
|
+
reason: "ENOENT: no such file or directory",
|
|
186
|
+
path
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
return content;
|
|
190
|
+
}),
|
|
191
|
+
writeFile: (path, content) => Effect.gen(function* () {
|
|
192
|
+
writeFileCalls.push({ path, content });
|
|
193
|
+
yield* checkFailure("writeFile", path);
|
|
194
|
+
// Auto-create parent directories
|
|
195
|
+
for (const dir of extractParentDirs(path)) {
|
|
196
|
+
directories.add(dir);
|
|
197
|
+
}
|
|
198
|
+
files.set(path, content);
|
|
199
|
+
}),
|
|
200
|
+
exists: (path) => Effect.gen(function* () {
|
|
201
|
+
existsCalls.push(path);
|
|
202
|
+
yield* checkFailure("exists", path);
|
|
203
|
+
return files.has(path) || directories.has(path);
|
|
204
|
+
}),
|
|
205
|
+
mkdir: (path) => Effect.gen(function* () {
|
|
206
|
+
mkdirCalls.push(path);
|
|
207
|
+
yield* checkFailure("mkdir", path);
|
|
208
|
+
// Create all parent directories recursively
|
|
209
|
+
for (const dir of extractParentDirs(path)) {
|
|
210
|
+
directories.add(dir);
|
|
211
|
+
}
|
|
212
|
+
directories.add(path);
|
|
213
|
+
}),
|
|
214
|
+
readdir: (path) => Effect.gen(function* () {
|
|
215
|
+
readdirCalls.push(path);
|
|
216
|
+
yield* checkFailure("readdir", path);
|
|
217
|
+
// Check if directory exists
|
|
218
|
+
if (!directories.has(path)) {
|
|
219
|
+
return yield* Effect.fail(new MockFileSystemError({
|
|
220
|
+
reason: "ENOENT: no such file or directory",
|
|
221
|
+
path
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
const entries = [];
|
|
225
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
226
|
+
// Find files directly in this directory
|
|
227
|
+
for (const filePath of files.keys()) {
|
|
228
|
+
const parent = getParentDir(filePath);
|
|
229
|
+
if (parent === normalizedPath) {
|
|
230
|
+
entries.push(getBasename(filePath));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// Find subdirectories directly in this directory
|
|
234
|
+
for (const dirPath of directories) {
|
|
235
|
+
const parent = getParentDir(dirPath);
|
|
236
|
+
if (parent === normalizedPath && dirPath !== normalizedPath) {
|
|
237
|
+
entries.push(getBasename(dirPath));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return entries;
|
|
241
|
+
})
|
|
242
|
+
});
|
|
243
|
+
return {
|
|
244
|
+
layer,
|
|
245
|
+
readFileCalls,
|
|
246
|
+
writeFileCalls,
|
|
247
|
+
existsCalls,
|
|
248
|
+
mkdirCalls,
|
|
249
|
+
readdirCalls,
|
|
250
|
+
getFiles: () => new Map(files),
|
|
251
|
+
getDirectories: () => new Set(directories),
|
|
252
|
+
reset: () => {
|
|
253
|
+
readFileCalls.length = 0;
|
|
254
|
+
writeFileCalls.length = 0;
|
|
255
|
+
existsCalls.length = 0;
|
|
256
|
+
mkdirCalls.length = 0;
|
|
257
|
+
readdirCalls.length = 0;
|
|
258
|
+
files.clear();
|
|
259
|
+
directories.clear();
|
|
260
|
+
for (const [k, v] of initialFiles) {
|
|
261
|
+
files.set(k, v);
|
|
262
|
+
}
|
|
263
|
+
for (const d of initialDirectories) {
|
|
264
|
+
directories.add(d);
|
|
265
|
+
}
|
|
266
|
+
// Re-add auto-created dirs from initial files
|
|
267
|
+
for (const filePath of initialFiles.keys()) {
|
|
268
|
+
for (const dir of extractParentDirs(filePath)) {
|
|
269
|
+
directories.add(dir);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
getCallCount: () => readFileCalls.length +
|
|
274
|
+
writeFileCalls.length +
|
|
275
|
+
existsCalls.length +
|
|
276
|
+
mkdirCalls.length +
|
|
277
|
+
readdirCalls.length
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
//# sourceMappingURL=file-system.mock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-system.mock.js","sourceRoot":"","sources":["../../src/mocks/file-system.mock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAIzE;IACA,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI;YACd,CAAC,CAAC,yBAAyB,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE;YACvD,CAAC,CAAC,sBAAsB,IAAI,CAAC,MAAM,EAAE,CAAA;IACzC,CAAC;CACF;AAED,+EAA+E;AAC/E,wDAAwD;AACxD,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAS3E;CAAG;AA0FN,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,IAAY,EAAiB,EAAE;IACnD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAC3C,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IAC7C,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAC/B,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;AAC3C,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,GAAG,CAAC,IAAY,EAAU,EAAE;IAC3C,MAAM,UAAU,GAAG,IAAI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CAAC;gBACnC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;YACpB,CAAC;YACD,8CAA8C;YAC9C,KAAK,MAAM,QAAQ,IAAI,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC3C,KAAK,MAAM,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC9C,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;QACD,YAAY,EAAE,GAAG,EAAE,CACjB,aAAa,CAAC,MAAM;YACpB,cAAc,CAAC,MAAM;YACrB,WAAW,CAAC,MAAM;YAClB,UAAU,CAAC,MAAM;YACjB,YAAY,CAAC,MAAM;KACtB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock services for testing.
|
|
3
|
+
*
|
|
4
|
+
* @module @tx/test-utils/mocks
|
|
5
|
+
*/
|
|
6
|
+
export { createMockAnthropic, createMockAnthropicForExtraction, type MockMessage, type MockAnthropicCall, type MockAnthropicResponse, type MockAnthropicConfig, type MockAnthropicResult } from "./anthropic.mock.js";
|
|
7
|
+
export { createMockOpenAI, createMockOpenAIForExtraction, createMockOpenAIForExtractionRaw, type MockOpenAIMessage, type MockOpenAIChatCall, type MockOpenAIChatResponse, type MockOpenAIConfig, type MockOpenAIResult } from "./openai.mock.js";
|
|
8
|
+
export { MockAstGrepService, MockAstGrepServiceTag, MockAstGrepError, type MockSymbolKind, type MockSymbolInfo, type MockImportKind, type MockImportInfo, type MockMatch, type MockAstGrepServiceConfig, type MockAstGrepServiceResult } from "./ast-grep.mock.js";
|
|
9
|
+
export { MockFileSystem, MockFileSystemServiceTag, MockFileSystemError, type MockFileSystemConfig, type MockFileSystemResult } from "./file-system.mock.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,mBAAmB,EACnB,gCAAgC,EAChC,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,gCAAgC,EAChC,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC9B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock services for testing.
|
|
3
|
+
*
|
|
4
|
+
* @module @tx/test-utils/mocks
|
|
5
|
+
*/
|
|
6
|
+
// Anthropic mock
|
|
7
|
+
export { createMockAnthropic, createMockAnthropicForExtraction } from "./anthropic.mock.js";
|
|
8
|
+
// OpenAI mock
|
|
9
|
+
export { createMockOpenAI, createMockOpenAIForExtraction, createMockOpenAIForExtractionRaw } from "./openai.mock.js";
|
|
10
|
+
// AstGrep mock
|
|
11
|
+
export { MockAstGrepService, MockAstGrepServiceTag, MockAstGrepError } from "./ast-grep.mock.js";
|
|
12
|
+
// FileSystem mock
|
|
13
|
+
export { MockFileSystem, MockFileSystemServiceTag, MockFileSystemError } from "./file-system.mock.js";
|
|
14
|
+
// TODO: Implement remaining mocks in tx-b28e5324 (PRD-013: Implement mock services)
|
|
15
|
+
// export { MockGit } from './git.mock.js'
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iBAAiB;AACjB,OAAO,EACL,mBAAmB,EACnB,gCAAgC,EAMjC,MAAM,qBAAqB,CAAA;AAE5B,cAAc;AACd,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,gCAAgC,EAMjC,MAAM,kBAAkB,CAAA;AAEzB,eAAe;AACf,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAQjB,MAAM,oBAAoB,CAAA;AAE3B,kBAAkB;AAClB,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EAGpB,MAAM,uBAAuB,CAAA;AAE9B,oFAAoF;AACpF,0CAA0C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock services unit tests.
|
|
3
|
+
*
|
|
4
|
+
* Tests all mock services for correct behavior:
|
|
5
|
+
* - createMockAnthropic: call tracking, response fixtures, failure injection
|
|
6
|
+
* - MockAstGrepService: findSymbols, getImports, empty results
|
|
7
|
+
* - MockFileSystem: read/write cycle, exists, failure injection
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=mocks.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mocks.test.d.ts","sourceRoot":"","sources":["../../src/mocks/mocks.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|