Commit 4582ef2
committed
Add typed mock factory utilities for testing
New testing utilities in common/src/testing/mocks/:
- createMockLogger() - typed logger mock with capture support
- createMockFetch(), installMockFetch() - typed fetch mock with call tracking
- createMockFs() - typed filesystem mock compatible with CodebuffFileSystem
- createMockTimers() - typed timer mock (deprecated, prefer Bun builtins)
- Tree-sitter mocks: createMockTreeSitterParser/Query/Captures
Test fixture improvements:
- createTestAgentRuntimeParams() for agent runtime testing
- mockFileContext, testClientEnv, testCiEnv exports
Bug fixes:
- Fix installMockFetch call-capture bug (calls now captured even after mockImplementation)
- Fix null guard in toContentString (prevents TypeError on null array items)
Updated test files to use typed mock factories:
- packages/code-map tests use tree-sitter mock utilities
- web/agents-transform.test.ts uses explicit type annotations
- Various agent-runtime tests use typed fixtures
Also trimmed verbose JSDoc comments across all testing utility files.1 parent 5e7fbbf commit 4582ef2
File tree
30 files changed
+3385
-613
lines changed- agents/e2e
- cli/src
- __tests__/unit
- hooks/__tests__
- common/src
- testing
- fixtures
- mocks
- util
- packages
- agent-runtime/src
- __tests__
- tools
- util
- __tests__
- bigquery/src
- code-map/__tests__
- sdk/src/__tests__
- web/src/server/__tests__
30 files changed
+3385
-613
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
13 | 36 | | |
14 | 37 | | |
15 | 38 | | |
| |||
154 | 177 | | |
155 | 178 | | |
156 | 179 | | |
157 | | - | |
158 | | - | |
| 180 | + | |
| 181 | + | |
159 | 182 | | |
160 | 183 | | |
161 | 184 | | |
| |||
164 | 187 | | |
165 | 188 | | |
166 | 189 | | |
167 | | - | |
168 | | - | |
| 190 | + | |
| 191 | + | |
169 | 192 | | |
170 | 193 | | |
171 | 194 | | |
| |||
280 | 303 | | |
281 | 304 | | |
282 | 305 | | |
283 | | - | |
284 | | - | |
| 306 | + | |
| 307 | + | |
285 | 308 | | |
286 | 309 | | |
287 | 310 | | |
288 | | - | |
289 | | - | |
| 311 | + | |
| 312 | + | |
290 | 313 | | |
291 | 314 | | |
292 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 107 | + | |
115 | 108 | | |
116 | 109 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 110 | + | |
| 111 | + | |
132 | 112 | | |
133 | 113 | | |
134 | 114 | | |
135 | | - | |
136 | | - | |
| 115 | + | |
137 | 116 | | |
138 | 117 | | |
139 | 118 | | |
| |||
150 | 129 | | |
151 | 130 | | |
152 | 131 | | |
153 | | - | |
154 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
155 | 135 | | |
156 | | - | |
| 136 | + | |
157 | 137 | | |
158 | 138 | | |
159 | 139 | | |
| |||
176 | 156 | | |
177 | 157 | | |
178 | 158 | | |
179 | | - | |
180 | | - | |
| 159 | + | |
181 | 160 | | |
182 | 161 | | |
183 | 162 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 149 | + | |
154 | 150 | | |
155 | 151 | | |
156 | | - | |
| 152 | + | |
157 | 153 | | |
158 | 154 | | |
159 | 155 | | |
160 | 156 | | |
161 | 157 | | |
162 | 158 | | |
163 | 159 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 160 | + | |
170 | 161 | | |
171 | 162 | | |
172 | | - | |
| 163 | + | |
173 | 164 | | |
174 | 165 | | |
175 | 166 | | |
176 | 167 | | |
177 | 168 | | |
178 | 169 | | |
179 | 170 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 171 | + | |
186 | 172 | | |
187 | 173 | | |
188 | | - | |
| 174 | + | |
189 | 175 | | |
190 | 176 | | |
191 | 177 | | |
| |||
255 | 241 | | |
256 | 242 | | |
257 | 243 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
| 244 | + | |
265 | 245 | | |
266 | 246 | | |
267 | | - | |
| 247 | + | |
268 | 248 | | |
269 | 249 | | |
270 | | - | |
| 250 | + | |
271 | 251 | | |
272 | 252 | | |
273 | 253 | | |
| |||
0 commit comments