mirror of
https://github.com/Routstr/routstrd.git
synced 2026-10-05 12:28:23 +00:00
test(integrations): align hermes merge test with in-place provider update (#82)
PR #72 changed mergeHermesConfig to update an existing Routstr provider
in place (base_url/api_key/model + rename, repointing model.provider),
but the test from f90e65a still asserted the old keep-unchanged
behavior and has failed since.
Update the test to assert the in-place update and idempotency, and add
coverage for the model.provider repoint (and that unrelated provider
refs are left alone).
Co-authored-by: redshift <213178690+1ftredsh@users.noreply.github.com>
This commit is contained in:
@@ -66,7 +66,7 @@ other_setting: true
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps an existing Routstr provider unchanged without duplicating it", () => {
|
||||
it("updates an existing Routstr provider in place without duplicating it", () => {
|
||||
const existing = `custom_providers:
|
||||
- name: Routstr (old-host:8008)
|
||||
base_url: http://old-host:8008/v1
|
||||
@@ -83,14 +83,51 @@ other_setting: true
|
||||
|
||||
expect(routstrProviders).toHaveLength(1);
|
||||
expect(routstrProviders[0]).toEqual({
|
||||
name: "Routstr (old-host:8008)",
|
||||
base_url: "http://old-host:8008/v1",
|
||||
api_key: "old-key",
|
||||
model: "old-model",
|
||||
name: "Routstr (localhost:8008)",
|
||||
base_url: ROUTSTR.baseUrl,
|
||||
api_key: ROUTSTR.apiKey,
|
||||
model: ROUTSTR.defaultModel,
|
||||
});
|
||||
expect(twice).toBe(once);
|
||||
});
|
||||
|
||||
it("repoints model.provider when the Routstr provider is renamed", () => {
|
||||
const existing = `model:
|
||||
default: old-model
|
||||
provider: custom:routstr-(old-host:8008)
|
||||
|
||||
custom_providers:
|
||||
- name: Routstr (old-host:8008)
|
||||
base_url: http://old-host:8008/v1
|
||||
api_key: old-key
|
||||
model: old-model
|
||||
`;
|
||||
|
||||
const merged = parse(mergeHermesConfig(existing, ROUTSTR));
|
||||
|
||||
expect(merged.model).toEqual({
|
||||
default: "old-model",
|
||||
provider: "custom:routstr-(localhost:8008)",
|
||||
});
|
||||
});
|
||||
|
||||
it("leaves model.provider alone when it does not reference the Routstr provider", () => {
|
||||
const existing = `model:
|
||||
default: user-model
|
||||
provider: custom:user-provider
|
||||
|
||||
custom_providers:
|
||||
- name: Routstr (old-host:8008)
|
||||
base_url: http://old-host:8008/v1
|
||||
api_key: old-key
|
||||
model: old-model
|
||||
`;
|
||||
|
||||
const merged = parse(mergeHermesConfig(existing, ROUTSTR));
|
||||
|
||||
expect(merged.model.provider).toBe("custom:user-provider");
|
||||
});
|
||||
|
||||
it("rejects malformed YAML instead of replacing it", () => {
|
||||
expect(() => mergeHermesConfig("model: [unterminated", ROUTSTR)).toThrow();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user