feat: add polar x tts and storage integration adapters with tests

This commit is contained in:
Codex
2026-02-18 13:35:03 +00:00
parent de2ddf258f
commit d68ccc70bf
10 changed files with 678 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
"use strict";
const test = require("node:test");
const assert = require("node:assert/strict");
const { createTTSAdapter } = require("../src/integrations/tts-client");
test("synthesize returns buffer from openai response", async () => {
const adapter = createTTSAdapter({
client: {
audio: {
speech: {
async create() {
return {
async arrayBuffer() {
return Uint8Array.from([1, 2, 3]).buffer;
},
};
},
},
},
},
});
const bytes = await adapter.synthesize("hello");
assert.equal(Buffer.isBuffer(bytes), true);
assert.equal(bytes.length, 3);
});
test("throws when tts adapter is not configured", async () => {
const adapter = createTTSAdapter({});
await assert.rejects(() => adapter.synthesize("hello"), /tts_not_configured/);
});