@@ -264,6 +264,35 @@ describe("memory cli", () => {
|
264 | 264 | expect(getMemorySearchManager).not.toHaveBeenCalled(); |
265 | 265 | }); |
266 | 266 | |
| 267 | +it.each([ |
| 268 | +[["search", "hello", "--max-results", "0x10"], "--max-results must be a positive integer."], |
| 269 | +[["search", "hello", "--max-results", "1e2"], "--max-results must be a positive integer."], |
| 270 | +[["search", "hello", "--min-score", "0x1"], "--min-score must be a finite number."], |
| 271 | +[["search", "hello", "--min-score", "1e-1"], "--min-score must be a finite number."], |
| 272 | +[ |
| 273 | +["promote", "--min-recall-count", "0x1"], |
| 274 | +"--min-recall-count must be a non-negative integer.", |
| 275 | +], |
| 276 | +[ |
| 277 | +["promote", "--min-unique-queries", "1e2"], |
| 278 | +"--min-unique-queries must be a non-negative integer.", |
| 279 | +], |
| 280 | +])("rejects non-decimal memory numeric option %j", async (args, message) => { |
| 281 | +const program = new Command(); |
| 282 | +program.name("test"); |
| 283 | +program.exitOverride(); |
| 284 | +program.configureOutput({ |
| 285 | +writeErr: () => {}, |
| 286 | +writeOut: () => {}, |
| 287 | +}); |
| 288 | +registerMemoryCli(program); |
| 289 | + |
| 290 | +await expect(program.parseAsync(["memory", ...args], { from: "user" })).rejects.toThrow( |
| 291 | +message, |
| 292 | +); |
| 293 | +expect(getMemorySearchManager).not.toHaveBeenCalled(); |
| 294 | +}); |
| 295 | + |
267 | 296 | it.each([ |
268 | 297 | ["--limit", "1.5", "--limit must be a positive integer."], |
269 | 298 | ["--min-recall-count", "1.5", "--min-recall-count must be a non-negative integer."], |
|