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,39 @@
"use strict";
const test = require("node:test");
const assert = require("node:assert/strict");
const { createStorageAdapter } = require("../src/integrations/storage-client");
test("uploadAudio sends put command", async () => {
const sent = [];
const adapter = createStorageAdapter({
bucket: "b1",
client: {
async send(command) {
sent.push(command.input);
},
},
signedUrlFactory: async () => "https://signed.example",
});
const res = await adapter.uploadAudio({
key: "audio/1.mp3",
body: Buffer.from("abc"),
});
assert.equal(res.bucket, "b1");
assert.equal(sent.length, 1);
assert.equal(sent[0].Bucket, "b1");
assert.equal(sent[0].Key, "audio/1.mp3");
});
test("getSignedDownloadUrl uses provided signer", async () => {
const adapter = createStorageAdapter({
bucket: "b1",
client: { async send() {} },
signedUrlFactory: async (_client, command, options) => `signed:${command.input.Key}:${options.expiresIn}`,
});
const url = await adapter.getSignedDownloadUrl("audio/2.mp3", 120);
assert.equal(url, "signed:audio/2.mp3:120");
});