@@ -7,13 +7,12 @@ const { createTemplate, makeTemplate } = require('../lib/eSignature/examples/cre
7
7
const { sendEnvelopeFromTemplate, makeEnvelope : makeEnvelopeForUsingTemplate } = require ( '../lib/eSignature/examples/useTemplate' ) ;
8
8
const { addDocToTemplate, makeEnvelope : makeEnvelopeForAddingDoc , document1 : document1ForAddingDoc , makeRecipientViewRequest : makeRecipientViewRequestForAddingDoc } = require ( '../lib/eSignature/examples/addDocToTemplate' )
9
9
const { setTabValues, makeEnvelope : makeEnvelopeForSetTabValues } = require ( '../lib/eSignature/examples/setTabValues' )
10
- const path = require ( 'path' ) ;
11
10
const { authenticate, areEqual } = require ( './testHelpers' ) ;
12
- const { TEST_TEMPLATE_PDF_FILE , TEST_TEMPLATE_DOCX_FILE , TEMPLATE_NAME , BASE_PATH , signerClientId, returnUrl, pingUrl } = require ( './constants' )
11
+ const { TEST_TEMPLATE_PDF_FILE , TEST_TEMPLATE_DOCX_FILE , TEMPLATE_NAME , BASE_PATH , signerClientId, returnUrl, pingUrl, CC_EMAIL , CC_NAME } = require ( './constants' )
13
12
14
13
let ACCOUNT_ID ;
15
14
let ACCESS_TOKEN ;
16
- let TEMPLATE_ID = "12345678-1234-1234-1234-123456789123" ;
15
+ let TEMPLATE_ID ;
17
16
18
17
describe ( 'templateTests' , function ( ) {
19
18
before ( async function ( ) {
@@ -25,7 +24,7 @@ describe ('templateTests', function() {
25
24
ACCESS_TOKEN = accessToken ;
26
25
} ) ;
27
26
28
- it ( 'createTemplate' , async function ( ) {
27
+ it ( 'createTemplate method should create the correct template definition if correct data is provided ' , async function ( ) {
29
28
this . timeout ( 0 ) ;
30
29
31
30
const newTemplateName = `${ TEMPLATE_NAME } _${ Date . now ( ) } ` ;
@@ -47,7 +46,7 @@ describe ('templateTests', function() {
47
46
should . equal ( createdNewTemplate , true ) ;
48
47
} ) ;
49
48
50
- it ( 'createTemplate_makeTemplate ' , async function ( ) {
49
+ it ( 'makeTemplate method of createTemplate example should create correct template definition if correct data is provided ' , async function ( ) {
51
50
this . timeout ( 0 ) ;
52
51
53
52
const args = {
@@ -236,15 +235,15 @@ describe ('templateTests', function() {
236
235
expect ( template ) . excluding ( [ '' ] ) . to . deep . equal ( expected ) ;
237
236
} ) ;
238
237
239
- it ( 'useTemplate' , async function ( ) {
238
+ it ( 'useTemplate method should create the envelope with template if correct data is provided ' , async function ( ) {
240
239
this . timeout ( 0 ) ;
241
240
242
241
const envelopeArgs = {
243
242
templateId : TEMPLATE_ID ,
244
243
signerEmail : settings . signerEmail ,
245
244
signerName : settings . signerName ,
246
-
247
- ccName : 'Test Name'
245
+ ccEmail : CC_EMAIL ,
246
+ ccName : CC_NAME
248
247
} ;
249
248
const args = {
250
249
accessToken : ACCESS_TOKEN ,
@@ -258,15 +257,15 @@ describe ('templateTests', function() {
258
257
should . exist ( results ) ;
259
258
} ) ;
260
259
261
- it ( 'useTemplate_makeEnvelope ' , async function ( ) {
260
+ it ( 'makeEnvelope method of useTemplate example should create correct envelope definition if correct data is provided ' , async function ( ) {
262
261
this . timeout ( 0 ) ;
263
262
264
263
const envelopeArgs = {
265
264
templateId : TEMPLATE_ID ,
266
265
signerEmail : settings . signerEmail ,
267
266
signerName : settings . signerName ,
268
-
269
- ccName : 'Test Name'
267
+ ccEmail : CC_EMAIL ,
268
+ ccName : CC_NAME
270
269
} ;
271
270
272
271
const expected = {
@@ -278,8 +277,8 @@ describe ('templateTests', function() {
278
277
roleName : "signer" ,
279
278
} ,
280
279
{
281
-
282
- name : 'Test Name' ,
280
+ email : CC_EMAIL ,
281
+ name : CC_NAME ,
283
282
roleName : "cc" ,
284
283
}
285
284
] ,
@@ -292,16 +291,16 @@ describe ('templateTests', function() {
292
291
expect ( areEqual ( envelope , expected ) ) . to . be . true ;
293
292
} ) ;
294
293
295
- it ( 'addDocToTemplate' , async function ( ) {
294
+ it ( 'addDocToTemplate method should correctly add document to a template if correct data is provided ' , async function ( ) {
296
295
this . timeout ( 0 ) ;
297
296
298
297
const envelopeArgs = {
299
298
templateId : TEMPLATE_ID ,
300
299
signerEmail : settings . signerEmail ,
301
300
signerName : settings . signerName ,
302
301
signerClientId : signerClientId ,
303
-
304
- ccName : 'Test Name' ,
302
+ ccEmail : CC_EMAIL ,
303
+ ccName : CC_NAME ,
305
304
item : 'Item' ,
306
305
quantity : '5' ,
307
306
dsReturnUrl : returnUrl ,
@@ -320,7 +319,7 @@ describe ('templateTests', function() {
320
319
should . exist ( redirectUrl ) ;
321
320
} ) ;
322
321
323
- it ( 'addDocToTemplate_makeEnvelope ' , async function ( ) {
322
+ it ( 'makeEnvelope method of addDocToTemplate should create the correct envelope definition if correct data is provided ' , async function ( ) {
324
323
this . timeout ( 0 ) ;
325
324
326
325
const item = 'Item' ;
@@ -331,8 +330,8 @@ describe ('templateTests', function() {
331
330
signerEmail : settings . signerEmail ,
332
331
signerName : settings . signerName ,
333
332
signerClientId : signerClientId ,
334
-
335
- ccName : 'Test Name' ,
333
+ ccEmail : CC_EMAIL ,
334
+ ccName : CC_NAME ,
336
335
item : item ,
337
336
quantity : quantity ,
338
337
dsReturnUrl : returnUrl ,
@@ -353,7 +352,7 @@ describe ('templateTests', function() {
353
352
color: darkblue;">Order Processing Division</h2>
354
353
<h4>Ordered by ${ settings . signerName } </h4>
355
354
<p style="margin-top:0em; margin-bottom:0em;">Email: ${ settings . signerEmail } </p>
356
- <p style="margin-top:0em; margin-bottom:0em;">Copy to: ${ 'Test Name' } , ${ '[email protected] ' } </p>
355
+ <p style="margin-top:0em; margin-bottom:0em;">Copy to: ${ CC_NAME } , ${ CC_EMAIL } </p>
357
356
<p style="margin-top:3em; margin-bottom:0em;">Item: <b>${ item } </b>, quantity: <b>${ quantity } </b> at market price.</p>
358
357
<p style="margin-top:3em;">
359
358
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.
@@ -380,8 +379,8 @@ describe ('templateTests', function() {
380
379
recipients : {
381
380
carbonCopies : [
382
381
{
383
-
384
- name : 'Test Name' ,
382
+ email : CC_EMAIL ,
383
+ name : CC_NAME ,
385
384
roleName : "cc" ,
386
385
recipientId : "2" ,
387
386
}
@@ -407,8 +406,8 @@ describe ('templateTests', function() {
407
406
recipients : {
408
407
carbonCopies : [
409
408
{
410
-
411
- name : 'Test Name' ,
409
+ email : CC_EMAIL ,
410
+ name : CC_NAME ,
412
411
roleName : "cc" ,
413
412
recipientId : "2" ,
414
413
}
@@ -451,7 +450,7 @@ describe ('templateTests', function() {
451
450
expect ( envelope ) . excluding ( [ '' ] ) . to . deep . equal ( expected ) ;
452
451
} ) ;
453
452
454
- it ( 'addDocToTemplate_document1 ' , async function ( ) {
453
+ it ( 'document1 method of addDocToTemplate example should return correct HTML document if correct data is provided ' , async function ( ) {
455
454
this . timeout ( 0 ) ;
456
455
457
456
const item = 'Item' ;
@@ -460,8 +459,8 @@ describe ('templateTests', function() {
460
459
templateId : TEMPLATE_ID ,
461
460
signerEmail : settings . signerEmail ,
462
461
signerName : settings . signerName ,
463
-
464
- ccName : 'Test Name' ,
462
+ ccEmail : CC_EMAIL ,
463
+ ccName : CC_NAME ,
465
464
item : item ,
466
465
quantity : quantity ,
467
466
} ;
@@ -480,7 +479,7 @@ describe ('templateTests', function() {
480
479
color: darkblue;">Order Processing Division</h2>
481
480
<h4>Ordered by ${ settings . signerName } </h4>
482
481
<p style="margin-top:0em; margin-bottom:0em;">Email: ${ settings . signerEmail } </p>
483
- <p style="margin-top:0em; margin-bottom:0em;">Copy to: ${ 'Test Name' } , ${ '[email protected] ' } </p>
482
+ <p style="margin-top:0em; margin-bottom:0em;">Copy to: ${ CC_NAME } , ${ CC_EMAIL } </p>
484
483
<p style="margin-top:3em; margin-bottom:0em;">Item: <b>${ item } </b>, quantity: <b>${ quantity } </b> at market price.</p>
485
484
<p style="margin-top:3em;">
486
485
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.
@@ -497,7 +496,7 @@ describe ('templateTests', function() {
497
496
expect ( document ) . to . be . equal ( expected ) ;
498
497
} ) ;
499
498
500
- it ( 'addDocToTemplate_makeRecipientView ' , async function ( ) {
499
+ it ( 'makeRecipientView method of addDocToTemplate example should create the correct recipient view request url if correct data is provided ' , async function ( ) {
501
500
this . timeout ( 0 ) ;
502
501
503
502
const envelopeArgs = {
@@ -524,7 +523,7 @@ describe ('templateTests', function() {
524
523
expect ( { ...viewRequest } ) . to . deep . equal ( { ...expected } ) ;
525
524
} ) ;
526
525
527
- it ( 'setTabValues' , async function ( ) {
526
+ it ( 'setTabValues method should correctly set the tab values of template if correct data is provided ' , async function ( ) {
528
527
this . timeout ( 0 ) ;
529
528
530
529
const envelopeArgs = {
@@ -547,7 +546,7 @@ describe ('templateTests', function() {
547
546
should . exist ( redirectUrl ) ;
548
547
} ) ;
549
548
550
- it ( 'setTabValues_makeEnvelope ' , async function ( ) {
549
+ it ( 'makeEnvelope method of setTabValues example should create correct envelope definition if correct data is provided ' , async function ( ) {
551
550
this . timeout ( 0 ) ;
552
551
553
552
const envelopeArgs = {
0 commit comments