Commit e2a0e91
authored
SDK-shape conformance test for SearchableIndex (#222)
* test: SDK-shape conformance guard for SearchableIndex (#220)
SearchableIndex is a hand-written interface and indexes.ts force-casts the SDK
index to it with as unknown as, which erases type checking; existing tests only
mock our own interface. So an SDK bump that renames or removes a method the code
calls would slip past the compiler and fail at runtime.
Assert the members the code relies on (describeIndexStats, namespace,
searchRecords, query) exist on a real SDK index handle, constructed offline with
no network. A compile-time assertion was tried but the SDK types the index too
loosely to catch drift without passing vacuously, so this is a runtime check;
verified a renamed member fails it.
* test: assert query/searchRecords on the namespace handle, not top-level (#220 review)
The code calls query and searchRecords through index.namespace(ns) (indexes.ts
namespace(ns).query, search.ts namespace(ns).searchRecords), so probe them on the
namespace handle rather than the top-level index. describeIndexStats/namespace and
the searchRecords index-fallback stay on the top-level index. Confirmed a bogus
namespace-handle member fails the test.1 parent 9ce9e7b commit e2a0e91
1 file changed
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments