Skip to content

Commit a3ffacb

Browse files
committed
fix the callback tests as well
1 parent 05b6ba4 commit a3ffacb

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

examples/callback-style/get_doc_list_download_docs.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('get_doc_list_download', function () {
1313
var integratorKey = config.integratorKey;
1414
var email = config.email;
1515
var password = config.password;
16-
var envelopeId = config.envelopeId;
16+
var envelopeId;
1717
var attachCertificate = false;
1818

1919
it('should return document list and documents', function (done) {
@@ -41,6 +41,18 @@ describe('get_doc_list_download', function () {
4141
});
4242
},
4343

44+
// **********************************************************************************
45+
// Step 2.1 - Get a valid envelopeId
46+
// **********************************************************************************
47+
function grabEnvelopeId (client, next) {
48+
client.folders.searchThroughEnvelopes('DocuSign', function (error, response) {
49+
assert.ok(!error, 'Unexpected ' + error);
50+
var sentItems = response.folderItems.filter(function (item) { return item.status === 'sent'; });
51+
envelopeId = sentItems[0].envelopeId;
52+
next(null, client);
53+
});
54+
},
55+
4456
// **********************************************************************************
4557
// Step 3 - Get Signed Documents
4658
// **********************************************************************************

examples/callback-style/get_envelope_info.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('get_envelope_info', function () {
1212
var integratorKey = config.integratorKey;
1313
var email = config.email;
1414
var password = config.password;
15-
var envelopeId = config.envelopeId;
15+
var envelopeId;
1616

1717
it('should return envelope information', function (done) {
1818
async.waterfall([
@@ -39,6 +39,18 @@ describe('get_envelope_info', function () {
3939
});
4040
},
4141

42+
// **********************************************************************************
43+
// Step 2.1 - Get a valid envelopeId
44+
// **********************************************************************************
45+
function grabEnvelopeId (client, next) {
46+
client.folders.searchThroughEnvelopes('DocuSign', function (error, response) {
47+
assert.ok(!error, 'Unexpected ' + error);
48+
var sentItems = response.folderItems.filter(function (item) { return item.status === 'sent'; });
49+
envelopeId = sentItems[0].envelopeId;
50+
next(null, client);
51+
});
52+
},
53+
4254
// **********************************************************************************
4355
// Step 3 - Get Envelope Information
4456
// **********************************************************************************

examples/callback-style/get_envelope_recipient_status.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('get_envelope_recipient_status', function () {
1212
var integratorKey = config.integratorKey;
1313
var email = config.email;
1414
var password = config.password;
15-
var envelopeId = config.envelopeId;
15+
var envelopeId;
1616

1717
it('should return recipient status information for the specified envelope', function (done) {
1818
async.waterfall([
@@ -39,6 +39,18 @@ describe('get_envelope_recipient_status', function () {
3939
});
4040
},
4141

42+
// **********************************************************************************
43+
// Step 2.1 - Get a valid envelopeId
44+
// **********************************************************************************
45+
function grabEnvelopeId (client, next) {
46+
client.folders.searchThroughEnvelopes('DocuSign', function (error, response) {
47+
assert.ok(!error, 'Unexpected ' + error);
48+
var sentItems = response.folderItems.filter(function (item) { return item.status === 'sent'; });
49+
envelopeId = sentItems[0].envelopeId;
50+
next(null, client);
51+
});
52+
},
53+
4254
// **********************************************************************************
4355
// Step 3 - Get Recipients of the Specified Envelope Id
4456
// **********************************************************************************

examples/callback-style/get_status_envelopes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('get_status_envelopes', function () {
1818
date.setMonth(date.getMonth() - 1);
1919
} else {
2020
date.setMonth(12);
21-
date.setYear(date.getYear() - 1);
21+
date.setYear(date.getFullYear() - 1);
2222
}
2323

2424
it('should return an envelope list', function (done) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"docs": "jsdoc -d doc -r docusign.js dsUtils.js components/ README.md",
88
"lint": "semistandard",
99
"check-config": "./scripts/check-config.js",
10-
"test-cb-examples": "mocha examples/callback-style",
10+
"test-cb-examples": "mocha -t 30000 examples/callback-style",
1111
"test-spec": "ava test/**/*.spec.js",
1212
"test-cov": "nyc --reporter=lcov ava test/**/*.spec.js test/*.spec.js",
1313
"test": "npm run lint && npm run test-cov"

0 commit comments

Comments
 (0)