mirror of
https://github.com/documenso/documenso.git
synced 2026-07-24 17:04:12 +10:00
refactor(pdf): deslop AcroForm import cleanup
This commit is contained in:
@@ -98,11 +98,8 @@ test.describe('AcroForm Import', () => {
|
||||
},
|
||||
});
|
||||
|
||||
// No fields are created at upload time.
|
||||
expect(envelope.fields).toHaveLength(0);
|
||||
|
||||
// The stored PDF still carries the original AcroForm widgets — they
|
||||
// survive the upload pipeline and are available to the import button.
|
||||
const pdfBuffer = await getFileServerSide(envelope.envelopeItems[0].documentData);
|
||||
|
||||
expect(await pdfHasFormFields(pdfBuffer)).toBe(true);
|
||||
@@ -226,21 +223,18 @@ test.describe('AcroForm Import', () => {
|
||||
expect(meta?.source).toBe('acroform');
|
||||
}
|
||||
|
||||
// FIELD_CREATED audit log entries match the number of imported fields.
|
||||
const auditEntries = await prisma.documentAuditLog.findMany({
|
||||
where: { envelopeId: after.id, type: 'FIELD_CREATED' },
|
||||
});
|
||||
|
||||
expect(auditEntries.length).toBe(after.fields.length);
|
||||
|
||||
// The envelope item now points at a new (flat) DocumentData record.
|
||||
expect(after.envelopeItems[0].documentDataId).not.toBe(oldDocumentDataId);
|
||||
|
||||
const flattenedPdf = await getFileServerSide(after.envelopeItems[0].documentData);
|
||||
|
||||
expect(await pdfHasFormFields(flattenedPdf)).toBe(false);
|
||||
|
||||
// The old DocumentData record has been cleaned up.
|
||||
const oldRecord = await prisma.documentData.findUnique({ where: { id: oldDocumentDataId } });
|
||||
|
||||
expect(oldRecord).toBeNull();
|
||||
|
||||
@@ -136,9 +136,6 @@ test.describe('Form Flattening', () => {
|
||||
expect(envelope.formValues).toEqual(TEST_FORM_VALUES);
|
||||
expect(envelope.type).toBe(EnvelopeType.DOCUMENT);
|
||||
|
||||
// DOCUMENT uploads no longer auto-flatten — the editor's "Import from
|
||||
// PDF form" button is the new flatten trigger. Inserted values remain
|
||||
// visible in the (still-interactive) widgets.
|
||||
const documentData = envelope.envelopeItems[0].documentData;
|
||||
const pdfBuffer = await getFileServerSide(documentData);
|
||||
|
||||
@@ -160,8 +157,6 @@ test.describe('Form Flattening', () => {
|
||||
const payload: TCreateEnvelopePayload = {
|
||||
type: EnvelopeType.DOCUMENT,
|
||||
title: 'Document without Form Values',
|
||||
// No formValues - form fields stay interactive until the user clicks
|
||||
// "Import from PDF form" in the editor.
|
||||
};
|
||||
|
||||
const formData = new FormData();
|
||||
@@ -188,7 +183,6 @@ test.describe('Form Flattening', () => {
|
||||
},
|
||||
});
|
||||
|
||||
// DOCUMENT uploads no longer auto-flatten.
|
||||
const documentData = envelope.envelopeItems[0].documentData;
|
||||
const pdfBuffer = await getFileServerSide(documentData);
|
||||
|
||||
@@ -749,7 +743,6 @@ test.describe('Form Flattening', () => {
|
||||
},
|
||||
});
|
||||
|
||||
// DOCUMENT uploads no longer auto-flatten; widgets remain interactive.
|
||||
const documentData = envelope.envelopeItems[0].documentData;
|
||||
const pdfBuffer = await getFileServerSide(documentData);
|
||||
|
||||
@@ -800,8 +793,6 @@ test.describe('Form Flattening', () => {
|
||||
[FORM_FIELDS.TEXT_FIELD]: 'Only this field',
|
||||
});
|
||||
|
||||
// DOCUMENT uploads no longer auto-flatten; widgets remain interactive
|
||||
// and the inserted value is visible inside the still-editable field.
|
||||
const documentData = envelope.envelopeItems[0].documentData;
|
||||
const pdfBuffer = await getFileServerSide(documentData);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user