@@ -7,7 +7,7 @@ const { sendEnvelopeForEmbeddedSigning, makeEnvelope: makeEnvelopeForEmbeddedSig
7
7
const { sendEnvelope, makeEnvelope : makeEnvelopeForSigningViaEmail , document1 } = require ( '../lib/eSignature/examples/signingViaEmail' )
8
8
const fs = require ( 'fs' ) ;
9
9
const path = require ( 'path' ) ;
10
- const { authenticate } = require ( './testHelpers' ) ;
10
+ const { authenticate, areEqual } = require ( './testHelpers' ) ;
11
11
const { signerClientId, pingUrl, returnUrl, TEST_PDF_FILE , TEST_DOCX_FILE , BASE_PATH } = require ( './constants' )
12
12
13
13
chai . use ( chaiExclude ) ;
@@ -63,6 +63,14 @@ describe ('envelopeTests', function() {
63
63
64
64
const expected = {
65
65
emailSubject : "Please sign this document" ,
66
+ documents : [
67
+ {
68
+ documentBase64 : Buffer . from ( fs . readFileSync ( path . resolve ( TEST_PDF_FILE ) ) ) . toString ( "base64" ) ,
69
+ name : "Lorem Ipsum" ,
70
+ fileExtension : "pdf" ,
71
+ documentId : "3" ,
72
+ }
73
+ ] ,
66
74
recipients : {
67
75
signers : [
68
76
{
@@ -89,7 +97,7 @@ describe ('envelopeTests', function() {
89
97
const envelope = await makeEnvelopeForEmbeddedSigning ( envelopeArgs ) ;
90
98
91
99
should . exist ( envelope ) ;
92
- expect ( envelope ) . excluding ( 'documents' ) . to . deep . equal ( expected ) ;
100
+ expect ( envelope ) . excluding ( [ '' ] ) . to . deep . equal ( expected ) ;
93
101
} ) ;
94
102
95
103
it ( 'embeddedSigning_makeRecipientView' , async function ( ) {
@@ -116,7 +124,6 @@ describe ('envelopeTests', function() {
116
124
const viewRequest = await makeRecipientViewRequest ( envelopeArgs ) ;
117
125
118
126
should . exist ( viewRequest ) ;
119
- // expect(JSON.stringify(expected)).to.be.equal(JSON.stringify(viewRequest));
120
127
expect ( { ...viewRequest } ) . to . deep . equal ( { ...expected } ) ;
121
128
} ) ;
122
129
@@ -147,6 +154,30 @@ describe ('envelopeTests', function() {
147
154
it ( 'signViaEmail_makeEnvelope' , async function ( ) {
148
155
this . timeout ( 0 ) ;
149
156
157
+ const document1Text = `
158
+ <!DOCTYPE html>
159
+ <html>
160
+ <head>
161
+ <meta charset="UTF-8">
162
+ </head>
163
+ <body style="font-family:sans-serif;margin-left:2em;">
164
+ <h1 style="font-family: 'Trebuchet MS', Helvetica, sans-serif;
165
+ color: darkblue;margin-bottom: 0;">World Wide Corp</h1>
166
+ <h2 style="font-family: 'Trebuchet MS', Helvetica, sans-serif;
167
+ margin-top: 0px;margin-bottom: 3.5em;font-size: 1em;
168
+ color: darkblue;">Order Processing Division</h2>
169
+ <h4>Ordered by ${ settings . signerName } </h4>
170
+ <p style="margin-top:0em; margin-bottom:0em;">Email: ${ settings . signerEmail } </p>
171
+ <p style="margin-top:0em; margin-bottom:0em;">Copy to: ${ 'Test Name' } , ${ '[email protected] ' } </p>
172
+ <p style="margin-top:3em;">
173
+ Candy bonbon pastry jujubes lollipop wafer biscuit biscuit. Topping brownie sesame snaps sweet roll pie. Croissant danish biscuit soufflé caramels jujubes jelly. Dragée danish caramels lemon drops dragée. Gummi bears cupcake biscuit tiramisu sugar plum pastry. Dragée gummies applicake pudding liquorice. Donut jujubes oat cake jelly-o. Dessert bear claw chocolate cake gummies lollipop sugar plum ice cream gummies cheesecake.
174
+ </p>
175
+ <!-- Note the anchor tag for the signature field is in white. -->
176
+ <h3 style="margin-top:3em;">Agreed: <span style="color:white;">**signature_1**/</span></h3>
177
+ </body>
178
+ </html>
179
+ ` ;
180
+
150
181
const envelopeArgs = {
151
182
signerEmail : settings . signerEmail ,
152
183
signerName : settings . signerName ,
@@ -159,6 +190,26 @@ describe ('envelopeTests', function() {
159
190
160
191
const expected = {
161
192
emailSubject : "Please sign this document set" ,
193
+ documents : [
194
+ {
195
+ documentBase64 : Buffer . from ( document1Text ) . toString ( "base64" ) ,
196
+ name : 'Order acknowledgement' ,
197
+ fileExtension : 'html' ,
198
+ documentId : '1' ,
199
+ } ,
200
+ {
201
+ documentBase64 : Buffer . from ( fs . readFileSync ( path . resolve ( TEST_DOCX_FILE ) ) ) . toString ( "base64" ) ,
202
+ name : "Battle Plan" ,
203
+ fileExtension : "docx" ,
204
+ documentId : "2" ,
205
+ } ,
206
+ {
207
+ documentBase64 : Buffer . from ( fs . readFileSync ( path . resolve ( TEST_PDF_FILE ) ) ) . toString ( "base64" ) ,
208
+ name : "Lorem Ipsum" ,
209
+ fileExtension : "pdf" ,
210
+ documentId : "3" ,
211
+ }
212
+ ] ,
162
213
recipients : {
163
214
signers : [
164
215
{
@@ -199,7 +250,7 @@ describe ('envelopeTests', function() {
199
250
const envelope = await makeEnvelopeForSigningViaEmail ( envelopeArgs ) ;
200
251
201
252
should . exist ( envelope ) ;
202
- expect ( envelope ) . excluding ( 'documents' ) . to . deep . equal ( expected ) ;
253
+ expect ( envelope ) . excluding ( [ '' ] ) . to . deep . equal ( expected ) ;
203
254
} ) ;
204
255
205
256
it ( 'signViaEmail_document1' , async function ( ) {
0 commit comments