🐛 Fixed problem with deleting files uploaded by an application (#793)

This commit is contained in:
Anton Shepilov
2025-01-27 16:40:47 +01:00
committed by GitHub
parent 5bace9c97e
commit 20d128d990
4 changed files with 30 additions and 3 deletions
@@ -15,6 +15,7 @@ import {
DriveItemDetailsMockClass,
} from "../common/entities/mock_entities";
import { Open } from "unzipper";
import { randomUUID } from "crypto";
describe("the Drive feature", () => {
let platform: TestPlatform;
@@ -121,6 +122,28 @@ describe("the Drive feature", () => {
expect(zip.files.map(f => f.path).sort()).toEqual(fileNames.sort())
});
it("Delete document that was uploaded by an application", async () => {
const doc = await currentUser.uploadRandomFileAndCreateDocument();
expect(doc.id).toBeDefined();
//update creator files
const update = await currentUser.platform.documentService.repository.findOne({id: doc.id})
update.creator = randomUUID();
await currentUser.platform.documentService.repository.save(update)
const updated = await currentUser.getDocumentOKCheck(doc.id);
expect(updated.item.creator).toBe(update.creator);
let deleteResponse = await currentUser.delete(doc.id);
expect(deleteResponse.statusCode).toEqual(200);
//delete from trash
deleteResponse = await currentUser.delete(doc.id);
expect(deleteResponse.statusCode).toEqual(200);
});
it("did create a version for a drive item", async () => {
const item = await currentUser.createDefaultDocument();
const fileUploadResponse = await e2e_createDocumentFile(platform);