test(phase7): lock downloadBlob file-client delegation

This commit is contained in:
2026-03-25 11:08:52 +00:00
parent e4bd8ab9b6
commit 391040b5ac
2 changed files with 67 additions and 0 deletions
+30
View File
@@ -215,6 +215,36 @@ test("document delete blob flows use signer hash", async () => {
);
});
test("document/downloadBlob delegates blob request config via file client helper", async () => {
const axios = createAxiosMock();
const logger = createLoggerMock();
axios.requestHandler = async (config) => {
return { data: { type: "blob", url: config.url } };
};
const document = loadServiceModule("documentDirectService.js", {
axios,
BASE_URL: "http://example.local",
consoleLogger: logger.consoleLogger,
hashAPIPath: () => ""
});
const result = await document.downloadBlob(
"MyContainer",
"folder/file.pdf"
);
assert.deepStrictEqual(normalize(result), {
type: "blob",
url: "http://example.local/api/file/downloadblob?container=mycontainer&blobname=folder/file.pdf"
});
assert.strictEqual(axios.calls.length, 1);
assert.strictEqual(axios.calls[0].type, "request");
assert.strictEqual(axios.calls[0].config.method, "get");
assert.strictEqual(axios.calls[0].config.responseType, "blob");
});
test("account/getPortalLogin appends hash and returns res.data", async () => {
const axios = createAxiosMock();
const logger = createLoggerMock();