feat: add polar x tts and storage integration adapters with tests
This commit is contained in:
32
test/tts-client-integration.test.js
Normal file
32
test/tts-client-integration.test.js
Normal 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/);
|
||||
});
|
||||
Reference in New Issue
Block a user