test(phase7): lock downloadBlob file-client delegation
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user