feat: switch audio and storage providers to qwen3 tts and minio
This commit is contained in:
@@ -9,31 +9,38 @@ test("uploadAudio sends put command", async () => {
|
||||
const adapter = createStorageAdapter({
|
||||
bucket: "b1",
|
||||
client: {
|
||||
async send(command) {
|
||||
sent.push(command.input);
|
||||
async putObject(bucket, key, body, size, metadata) {
|
||||
sent.push({ bucket, key, body, size, metadata });
|
||||
},
|
||||
async presignedGetObject() {},
|
||||
},
|
||||
signedUrlFactory: async () => "https://signed.example",
|
||||
});
|
||||
|
||||
const payload = Buffer.from("abc");
|
||||
const res = await adapter.uploadAudio({
|
||||
key: "audio/1.mp3",
|
||||
body: Buffer.from("abc"),
|
||||
body: payload,
|
||||
});
|
||||
|
||||
assert.equal(res.bucket, "b1");
|
||||
assert.equal(sent.length, 1);
|
||||
assert.equal(sent[0].Bucket, "b1");
|
||||
assert.equal(sent[0].Key, "audio/1.mp3");
|
||||
assert.equal(sent[0].bucket, "b1");
|
||||
assert.equal(sent[0].key, "audio/1.mp3");
|
||||
assert.equal(sent[0].size, payload.length);
|
||||
assert.equal(sent[0].metadata["Content-Type"], "audio/mpeg");
|
||||
});
|
||||
|
||||
test("getSignedDownloadUrl uses provided signer", async () => {
|
||||
test("getSignedDownloadUrl uses minio presigner with ttl", async () => {
|
||||
const adapter = createStorageAdapter({
|
||||
bucket: "b1",
|
||||
client: { async send() {} },
|
||||
signedUrlFactory: async (_client, command, options) => `signed:${command.input.Key}:${options.expiresIn}`,
|
||||
client: {
|
||||
async putObject() {},
|
||||
async presignedGetObject(bucket, key, expiresIn) {
|
||||
return `signed:${bucket}:${key}:${expiresIn}`;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const url = await adapter.getSignedDownloadUrl("audio/2.mp3", 120);
|
||||
assert.equal(url, "signed:audio/2.mp3:120");
|
||||
assert.equal(url, "signed:b1:audio/2.mp3:120");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user