salesforce-composite-envelo.../composite-envelope-builder/force-app/main/default/classes/DocusignCompositeEnvelopeBu...

30 lines
1.4 KiB
OpenEdge ABL

// Assert
System.assertEquals(true, results[0].success, 'Should succeed without subject');
}
@isTest
static void testEmailSubjectTruncation() {
// Arrange
dfsle.TestUtils.setMock(new dfsle.ESignatureAPIMock());
DocusignEnvelopeRequest req = new DocusignEnvelopeRequest();
req.templateIds = new List<String>{'01234567-abcd-ef01-2345-6789abcdef01'};
req.recordId = '001000000ABC123';
// Create a subject longer than 100 characters
req.emailSubject = 'This is a very long email subject that exceeds the one hundred character limit imposed by Docusign API requirements and should be truncated appropriately to prevent errors during envelope creation.';
System.assert(req.emailSubject.length() > 100, 'Test setup: subject should be > 100 chars');
// Act
Test.startTest();
List<DocusignEnvelopeResult> results =
DocusignCompositeEnvelopeBuilder.sendCompositeEnvelope(
new List<DocusignEnvelopeRequest>{req}
);
Test.stopTest();
// Assert
System.assertEquals(true, results[0].success, 'Should succeed with truncated subject');
// Note: We can't easily test the actual truncation in this mock-based test,
// but the code change ensures truncation happens before the API call
}
}