Skip to content

Commit b19f8da

Browse files
updated test titles
1 parent f4ba58e commit b19f8da

File tree

3 files changed

+53
-51
lines changed

3 files changed

+53
-51
lines changed

test/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const TEST_DOCX_FILE = './test/docs/World_Wide_Corp_Battle_Plan_Trafalgar.docx';
1414
const TEST_TEMPLATE_PDF_FILE = './test/docs/World_Wide_Corp_fields.pdf';
1515
const TEST_TEMPLATE_DOCX_FILE = './test/docs/World_Wide_Corp_salary.docx';
1616
const TEMPLATE_NAME = 'Test Template';
17+
const CC_NAME = 'Test Name';
18+
const CC_EMAIL = '[email protected]';
1719

1820
module.exports = {
1921
signerClientId,
@@ -30,4 +32,6 @@ module.exports = {
3032
TEST_TEMPLATE_PDF_FILE,
3133
TEMPLATE_NAME,
3234
TEST_TEMPLATE_DOCX_FILE,
35+
CC_NAME,
36+
CC_EMAIL,
3337
};

test/envelopeTests.js

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { sendEnvelope, makeEnvelope: makeEnvelopeForSigningViaEmail, document1 }
88
const fs = require('fs');
99
const path = require('path');
1010
const { authenticate, areEqual } = require('./testHelpers');
11-
const { signerClientId, pingUrl, returnUrl, TEST_PDF_FILE, TEST_DOCX_FILE, BASE_PATH } = require('./constants')
11+
const { signerClientId, pingUrl, returnUrl, TEST_PDF_FILE, TEST_DOCX_FILE, BASE_PATH, CC_EMAIL, CC_NAME } = require('./constants')
1212

1313
chai.use(chaiExclude);
1414

@@ -25,7 +25,7 @@ describe ('envelopeTests', function() {
2525
ACCESS_TOKEN = accessToken;
2626
});
2727

28-
it('embeddedSigning', async function() {
28+
it('sendEnvelopeForEmbeddedSigning method should create an envelope and a recipients view for the envelope if correct data is provided', async function() {
2929
this.timeout(0);
3030

3131
const envelopeArgs = {
@@ -49,7 +49,7 @@ describe ('envelopeTests', function() {
4949
should.exist(redirectUrl);
5050
});
5151

52-
it('embeddedSigning_makeEnvelope', async function() {
52+
it('makeEnvelope method of embeddedSigning example should create the correct envelope definition if correct data is provided', async function() {
5353
this.timeout(0);
5454

5555
const envelopeArgs = {
@@ -100,7 +100,7 @@ describe ('envelopeTests', function() {
100100
expect(envelope).excluding(['']).to.deep.equal(expected);
101101
});
102102

103-
it('embeddedSigning_makeRecipientView', async function() {
103+
it('makeRecipientView method should create the correct recipient view request url if correct data is provided', async function() {
104104
this.timeout(0);
105105

106106
const envelopeArgs = {
@@ -127,14 +127,14 @@ describe ('envelopeTests', function() {
127127
expect({...viewRequest}).to.deep.equal({...expected});
128128
});
129129

130-
it('signViaEmail', async function() {
130+
it('signViaEmail method creates the envelope and sends it via email when correct data is provided', async function() {
131131
this.timeout(0);
132132

133133
const envelopeArgs = {
134134
signerEmail: settings.signerEmail,
135135
signerName: settings.signerName,
136-
ccEmail: '[email protected]',
137-
ccName: 'Test Name',
136+
ccEmail: CC_EMAIL,
137+
ccName: CC_NAME,
138138
status: 'sent',
139139
doc2File: path.resolve(TEST_DOCX_FILE),
140140
doc3File: path.resolve(TEST_PDF_FILE),
@@ -151,7 +151,7 @@ describe ('envelopeTests', function() {
151151
should.exist(envelopeId);
152152
});
153153

154-
it('signViaEmail_makeEnvelope', async function() {
154+
it('makeEnvelope method of signViaEmail example should create the correct envelope definition if correct data is provided', async function() {
155155
this.timeout(0);
156156

157157
const document1Text = `
@@ -168,7 +168,7 @@ describe ('envelopeTests', function() {
168168
color: darkblue;">Order Processing Division</h2>
169169
<h4>Ordered by ${settings.signerName}</h4>
170170
<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>
171+
<p style="margin-top:0em; margin-bottom:0em;">Copy to: ${CC_NAME}, ${CC_EMAIL}</p>
172172
<p style="margin-top:3em;">
173173
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.
174174
</p>
@@ -181,8 +181,8 @@ describe ('envelopeTests', function() {
181181
const envelopeArgs = {
182182
signerEmail: settings.signerEmail,
183183
signerName: settings.signerName,
184-
ccEmail: '[email protected]',
185-
ccName: 'Test Name',
184+
ccEmail: CC_EMAIL,
185+
ccName: CC_NAME,
186186
status: 'sent',
187187
doc2File: path.resolve(TEST_DOCX_FILE),
188188
doc3File: path.resolve(TEST_PDF_FILE),
@@ -237,8 +237,8 @@ describe ('envelopeTests', function() {
237237
],
238238
carbonCopies: [
239239
{
240-
241-
name: 'Test Name',
240+
email: CC_EMAIL,
241+
name: CC_NAME,
242242
routingOrder: '2',
243243
recipientId: '2'
244244
}
@@ -253,14 +253,14 @@ describe ('envelopeTests', function() {
253253
expect(envelope).excluding(['']).to.deep.equal(expected);
254254
});
255255

256-
it('signViaEmail_document1', async function() {
256+
it('document1 should return correct html document if correct data is provided', async function() {
257257
this.timeout(0);
258258

259259
const envelopeArgs = {
260260
signerEmail: settings.signerEmail,
261261
signerName: settings.signerName,
262-
ccEmail: '[email protected]',
263-
ccName: 'Test Name',
262+
ccEmail: CC_EMAIL,
263+
ccName: CC_NAME,
264264
};
265265

266266
const expected = `
@@ -277,7 +277,7 @@ describe ('envelopeTests', function() {
277277
color: darkblue;">Order Processing Division</h2>
278278
<h4>Ordered by ${settings.signerName}</h4>
279279
<p style="margin-top:0em; margin-bottom:0em;">Email: ${settings.signerEmail}</p>
280-
<p style="margin-top:0em; margin-bottom:0em;">Copy to: ${'Test Name'}, ${'[email protected]'}</p>
280+
<p style="margin-top:0em; margin-bottom:0em;">Copy to: ${CC_NAME}, ${CC_EMAIL}</p>
281281
<p style="margin-top:3em;">
282282
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.
283283
</p>
@@ -292,9 +292,8 @@ describe ('envelopeTests', function() {
292292
should.exist(document);
293293
expect(document).to.contain(settings.signerEmail);
294294
expect(document).to.contain(settings.signerName);
295-
expect(document).to.contain('[email protected]');
296-
expect(document).to.contain('Test Name');
295+
expect(document).to.contain(CC_EMAIL);
296+
expect(document).to.contain(CC_NAME);
297297
expect(document).to.be.equal(expected);
298298
});
299-
300299
})

test/templateTests.js

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ const { createTemplate, makeTemplate } = require('../lib/eSignature/examples/cre
77
const { sendEnvelopeFromTemplate, makeEnvelope: makeEnvelopeForUsingTemplate } = require('../lib/eSignature/examples/useTemplate');
88
const { addDocToTemplate, makeEnvelope: makeEnvelopeForAddingDoc, document1: document1ForAddingDoc, makeRecipientViewRequest: makeRecipientViewRequestForAddingDoc } = require('../lib/eSignature/examples/addDocToTemplate')
99
const { setTabValues, makeEnvelope: makeEnvelopeForSetTabValues } = require('../lib/eSignature/examples/setTabValues')
10-
const path = require('path');
1110
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')
1312

1413
let ACCOUNT_ID;
1514
let ACCESS_TOKEN;
16-
let TEMPLATE_ID = "12345678-1234-1234-1234-123456789123";
15+
let TEMPLATE_ID;
1716

1817
describe ('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: '[email protected]',
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: '[email protected]',
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-
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: '[email protected]',
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: '[email protected]',
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'}, ${'[email protected]'}</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-
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-
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: '[email protected]',
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'}, ${'[email protected]'}</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

Comments
 (0)