mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
test(ui): cover the third semantic-cache detection signal
CacheSettings opens the semantic section when any of three things is present in the saved config: redis_type === "semantic", similarity_threshold, or redis_semantic_cache_embedding_model. The first two had tests; the third did not. A config saved with only an embedding model set — no similarity_threshold, and redis_type left as a deployment topology rather than "semantic" — is the case that goes uncovered. If that clause were ever dropped, such a config would come back with the semantic section closed and the user would silently lose the model they had configured. Verified as a mutation test rather than assumed: deleting the redis_semantic_cache_embedding_model clause from index.tsx fails this test, and only this test (1 failed, 12 passed). With the clause present, 13 pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
4e611b238a
commit
c5f7835a3a
1 changed files with 13 additions and 0 deletions
|
|
@ -78,6 +78,19 @@ describe("CacheSettings", () => {
|
|||
expect(screen.getByText("Embedding Model")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should reveal the semantic fields when redis_semantic_cache_embedding_model is present", async () => {
|
||||
// The third signal the component detects on. A config saved with only an
|
||||
// embedding model set — no similarity_threshold, and redis_type left as a
|
||||
// deployment topology rather than "semantic" — must still come back with the
|
||||
// semantic section open, or the user silently loses the model they configured.
|
||||
getCacheSettingsCall.mockResolvedValue({
|
||||
current_values: { redis_semantic_cache_embedding_model: "text-embedding-3-small" },
|
||||
});
|
||||
renderSettings();
|
||||
expect(await screen.findByText("Similarity Threshold")).toBeInTheDocument();
|
||||
expect(screen.getByText("Embedding Model")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should NOT reveal the semantic fields when similarity_threshold is null", async () => {
|
||||
getCacheSettingsCall.mockResolvedValue({ current_values: { similarity_threshold: null } });
|
||||
renderSettings();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue