test: cover Google telephony TTS private network opt-in

This commit is contained in:
Peter Steinberger
2026-04-25 20:29:00 +01:00
parent cab66c5556
commit 8fb24ac3ce
2 changed files with 30 additions and 0 deletions

View File

@@ -344,4 +344,31 @@ describe("Google speech provider", () => {
expect.objectContaining({ allowPrivateNetwork: true }),
);
});
it("honors configured private-network opt-in for Google telephony TTS", async () => {
installGoogleTtsFetchMock();
const postJsonRequestSpy = vi.spyOn(providerHttp, "postJsonRequest");
const provider = buildGoogleSpeechProvider();
await provider.synthesizeTelephony?.({
text: "hello",
cfg: {
models: {
providers: {
google: {
baseUrl: "https://generativelanguage.googleapis.com/v1beta",
request: { allowPrivateNetwork: true },
models: [],
},
},
},
},
providerConfig: { apiKey: "google-test-key" },
timeoutMs: 12_345,
});
expect(postJsonRequestSpy).toHaveBeenCalledWith(
expect.objectContaining({ allowPrivateNetwork: true }),
);
});
});