🐛Fix bug with sending files with response stream
Also updated another dependencies and removed old version of the fastify multipart plugin
This commit is contained in:
committed by
Anton Shepilov
parent
999e3087e8
commit
2884193072
@@ -22,15 +22,14 @@ describe("the Drive feature", () => {
|
||||
configGetSpy = jest.spyOn(config, "get");
|
||||
|
||||
configHasSpy.mockImplementation((setting: string) => {
|
||||
const value = jest.requireActual("config").has(setting);
|
||||
return value;
|
||||
return jest.requireActual("config").has(setting);
|
||||
});
|
||||
configGetSpy.mockImplementation((setting: string) => {
|
||||
if (setting === "drive.featureUserQuota") {
|
||||
return true;
|
||||
}
|
||||
if (setting === "drive.defaultUserQuota") {
|
||||
return 2000000;
|
||||
return 1000000;
|
||||
}
|
||||
return jest.requireActual("config").get(setting);
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ import { getFilePath } from "../../../src/services/files/services";
|
||||
import UserApi from "../common/user-api";
|
||||
import LocalConnectorService from "../../../src/core/platform/services/storage/connectors/local/service"
|
||||
import { Client as MinioClient } from "minio"
|
||||
import { toInteger } from "lodash";
|
||||
|
||||
describe("The Files feature", () => {
|
||||
const url = "/internal/services/files/v1";
|
||||
@@ -78,9 +79,14 @@ describe("The Files feature", () => {
|
||||
method: "GET",
|
||||
url: `${url}/companies/${platform.workspace.company_id}/files/${filesUpload.id}/download`,
|
||||
});
|
||||
//then file should be not found with 404 error and "File not found message"
|
||||
expect(fileDownloadResponse).toBeTruthy();
|
||||
expect(fileDownloadResponse.statusCode).toBe(200);
|
||||
//check the content length header that it's not empty
|
||||
expect(fileDownloadResponse.headers["content-length"]).toBeDefined();
|
||||
let length = toInteger(fileDownloadResponse.headers["content-length"]);
|
||||
expect(length).toBeGreaterThan(0)
|
||||
//and data is in place
|
||||
expect((fileDownloadResponse.stream().read(100) as Buffer).length).toBeGreaterThanOrEqual(100)
|
||||
});
|
||||
|
||||
it.skip("should save file and generate previews", async () => {
|
||||
|
||||
Reference in New Issue
Block a user