@@ -7,13 +7,12 @@ const { createTemplate, makeTemplate } = require('../lib/eSignature/examples/cre
77const { sendEnvelopeFromTemplate, makeEnvelope : makeEnvelopeForUsingTemplate } = require ( '../lib/eSignature/examples/useTemplate' ) ;
88const { addDocToTemplate, makeEnvelope : makeEnvelopeForAddingDoc , document1 : document1ForAddingDoc , makeRecipientViewRequest : makeRecipientViewRequestForAddingDoc } = require ( '../lib/eSignature/examples/addDocToTemplate' )
99const { setTabValues, makeEnvelope : makeEnvelopeForSetTabValues } = require ( '../lib/eSignature/examples/setTabValues' )
10- const path = require ( 'path' ) ;
1110const { 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' )
1312
1413let ACCOUNT_ID ;
1514let ACCESS_TOKEN ;
16- let TEMPLATE_ID = "12345678-1234-1234-1234-123456789123" ;
15+ let TEMPLATE_ID ;
1716
1817describe ( 'templateTests' , function ( ) {
1918 before ( async function ( ) {
@@ -25,7 +24,7 @@ describe ('templateTests', function() {
2524 ACCESS_TOKEN = accessToken ;
2625 } ) ;
2726
28- it ( 'createTemplate' , async function ( ) {
27+ it ( 'createTemplate method should create the correct template definition if correct data is provided ' , async function ( ) {
2928 this . timeout ( 0 ) ;
3029
3130 const newTemplateName = `${ TEMPLATE_NAME } _${ Date . now ( ) } ` ;
@@ -47,7 +46,7 @@ describe ('templateTests', function() {
4746 should . equal ( createdNewTemplate , true ) ;
4847 } ) ;
4948
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 ( ) {
5150 this . timeout ( 0 ) ;
5251
5352 const args = {
@@ -236,15 +235,15 @@ describe ('templateTests', function() {
236235 expect ( template ) . excluding ( [ '' ] ) . to . deep . equal ( expected ) ;
237236 } ) ;
238237
239- it ( 'useTemplate' , async function ( ) {
238+ it ( 'useTemplate method should create the envelope with template if correct data is provided ' , async function ( ) {
240239 this . timeout ( 0 ) ;
241240
242241 const envelopeArgs = {
243242 templateId : TEMPLATE_ID ,
244243 signerEmail : settings . signerEmail ,
245244 signerName : settings . signerName ,
246- ccEmail : 'test@mail.com' ,
247- ccName : 'Test Name'
245+ ccEmail : CC_EMAIL ,
246+ ccName : CC_NAME
248247 } ;
249248 const args = {
250249 accessToken : ACCESS_TOKEN ,
@@ -258,15 +257,15 @@ describe ('templateTests', function() {
258257 should . exist ( results ) ;
259258 } ) ;
260259
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 ( ) {
262261 this . timeout ( 0 ) ;
263262
264263 const envelopeArgs = {
265264 templateId : TEMPLATE_ID ,
266265 signerEmail : settings . signerEmail ,
267266 signerName : settings . signerName ,
268- ccEmail : 'test@mail.com' ,
269- ccName : 'Test Name'
267+ ccEmail : CC_EMAIL ,
268+ ccName : CC_NAME
270269 } ;
271270
272271 const expected = {
@@ -278,8 +277,8 @@ describe ('templateTests', function() {
278277 roleName : "signer" ,
279278 } ,
280279 {
281- email : 'test@mail.com' ,
282- name : 'Test Name' ,
280+ email : CC_EMAIL ,
281+ name : CC_NAME ,
283282 roleName : "cc" ,
284283 }
285284 ] ,
@@ -292,16 +291,16 @@ describe ('templateTests', function() {
292291 expect ( areEqual ( envelope , expected ) ) . to . be . true ;
293292 } ) ;
294293
295- it ( 'addDocToTemplate' , async function ( ) {
294+ it ( 'addDocToTemplate method should correctly add document to a template if correct data is provided ' , async function ( ) {
296295 this . timeout ( 0 ) ;
297296
298297 const envelopeArgs = {
299298 templateId : TEMPLATE_ID ,
300299 signerEmail : settings . signerEmail ,
301300 signerName : settings . signerName ,
302301 signerClientId : signerClientId ,
303- ccEmail : 'test@mail.com' ,
304- ccName : 'Test Name' ,
302+ ccEmail : CC_EMAIL ,
303+ ccName : CC_NAME ,
305304 item : 'Item' ,
306305 quantity : '5' ,
307306 dsReturnUrl : returnUrl ,
@@ -320,7 +319,7 @@ describe ('templateTests', function() {
320319 should . exist ( redirectUrl ) ;
321320 } ) ;
322321
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 ( ) {
324323 this . timeout ( 0 ) ;
325324
326325 const item = 'Item' ;
@@ -331,8 +330,8 @@ describe ('templateTests', function() {
331330 signerEmail : settings . signerEmail ,
332331 signerName : settings . signerName ,
333332 signerClientId : signerClientId ,
334- ccEmail : 'test@mail.com' ,
335- ccName : 'Test Name' ,
333+ ccEmail : CC_EMAIL ,
334+ ccName : CC_NAME ,
336335 item : item ,
337336 quantity : quantity ,
338337 dsReturnUrl : returnUrl ,
@@ -353,7 +352,7 @@ describe ('templateTests', function() {
353352 color: darkblue;">Order Processing Division</h2>
354353 <h4>Ordered by ${ settings . signerName } </h4>
355354 <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' } , ${ 'test@mail.com' } </p>
355+ <p style="margin-top:0em; margin-bottom:0em;">Copy to: ${ CC_NAME } , ${ CC_EMAIL } </p>
357356 <p style="margin-top:3em; margin-bottom:0em;">Item: <b>${ item } </b>, quantity: <b>${ quantity } </b> at market price.</p>
358357 <p style="margin-top:3em;">
359358 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() {
380379 recipients : {
381380 carbonCopies : [
382381 {
383- email : 'test@mail.com' ,
384- name : 'Test Name' ,
382+ email : CC_EMAIL ,
383+ name : CC_NAME ,
385384 roleName : "cc" ,
386385 recipientId : "2" ,
387386 }
@@ -407,8 +406,8 @@ describe ('templateTests', function() {
407406 recipients : {
408407 carbonCopies : [
409408 {
410- email : 'test@mail.com' ,
411- name : 'Test Name' ,
409+ email : CC_EMAIL ,
410+ name : CC_NAME ,
412411 roleName : "cc" ,
413412 recipientId : "2" ,
414413 }
@@ -451,7 +450,7 @@ describe ('templateTests', function() {
451450 expect ( envelope ) . excluding ( [ '' ] ) . to . deep . equal ( expected ) ;
452451 } ) ;
453452
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 ( ) {
455454 this . timeout ( 0 ) ;
456455
457456 const item = 'Item' ;
@@ -460,8 +459,8 @@ describe ('templateTests', function() {
460459 templateId : TEMPLATE_ID ,
461460 signerEmail : settings . signerEmail ,
462461 signerName : settings . signerName ,
463- ccEmail : 'test@mail.com' ,
464- ccName : 'Test Name' ,
462+ ccEmail : CC_EMAIL ,
463+ ccName : CC_NAME ,
465464 item : item ,
466465 quantity : quantity ,
467466 } ;
@@ -480,7 +479,7 @@ describe ('templateTests', function() {
480479 color: darkblue;">Order Processing Division</h2>
481480 <h4>Ordered by ${ settings . signerName } </h4>
482481 <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' } , ${ 'test@mail.com' } </p>
482+ <p style="margin-top:0em; margin-bottom:0em;">Copy to: ${ CC_NAME } , ${ CC_EMAIL } </p>
484483 <p style="margin-top:3em; margin-bottom:0em;">Item: <b>${ item } </b>, quantity: <b>${ quantity } </b> at market price.</p>
485484 <p style="margin-top:3em;">
486485 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() {
497496 expect ( document ) . to . be . equal ( expected ) ;
498497 } ) ;
499498
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 ( ) {
501500 this . timeout ( 0 ) ;
502501
503502 const envelopeArgs = {
@@ -524,7 +523,7 @@ describe ('templateTests', function() {
524523 expect ( { ...viewRequest } ) . to . deep . equal ( { ...expected } ) ;
525524 } ) ;
526525
527- it ( 'setTabValues' , async function ( ) {
526+ it ( 'setTabValues method should correctly set the tab values of template if correct data is provided ' , async function ( ) {
528527 this . timeout ( 0 ) ;
529528
530529 const envelopeArgs = {
@@ -547,7 +546,7 @@ describe ('templateTests', function() {
547546 should . exist ( redirectUrl ) ;
548547 } ) ;
549548
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 ( ) {
551550 this . timeout ( 0 ) ;
552551
553552 const envelopeArgs = {
0 commit comments