Added support of the session editing key for the OnlyOffice connector

This commit is contained in:
Anton SHEPILOV
2024-08-25 22:26:29 +02:00
committed by Eric Doughty-Papassideris
parent b6be90f825
commit c66123f450
9 changed files with 217 additions and 53 deletions
@@ -4,6 +4,7 @@ import { init, TestPlatform } from "../setup";
import UserApi from "../common/user-api";
import { DriveFile, TYPE as DriveFileType } from "../../../src/services/documents/entities/drive-file";
import exp = require("node:constants");
describe("the Drive's documents' editing session kind-of-lock", () => {
let platform: TestPlatform | null;
@@ -110,8 +111,28 @@ describe("the Drive's documents' editing session kind-of-lock", () => {
expect(temporaryDocument.id).toBe(foundDocumentResult.json().id);
});
it('can end an editing session on a document only once with the right key', async () => {
it('can cancel an editing session on a document only once with the right key', async () => {
//given
const editingSessionKey = await currentUser.beginEditingDocumentExpectOk(temporaryDocument.id, 'e2e_testing');
//when
const response = await currentUser.cancelEditingDocument(editingSessionKey);
//then
expect(response.statusCode).toBe(200);
const newSessionKey = await currentUser.beginEditingDocumentExpectOk(temporaryDocument.id, 'e2e_testing');
expect(newSessionKey).not.toEqual(editingSessionKey);
});
it('can end editing with a new version of document', async () => {
//given
const editingSessionKey = await currentUser.beginEditingDocumentExpectOk(temporaryDocument.id, 'e2e_testing');
//when
const response = await currentUser.endEditingDocument(editingSessionKey);
//then
expect(response.statusCode).toBe(200);
const document = await currentUser.getDocumentOKCheck(temporaryDocument.id);
expect(document.versions.length).toEqual(2);
});
});