diff --git a/test/upload.js b/test/upload.js index f91a932c..af49b07a 100644 --- a/test/upload.js +++ b/test/upload.js @@ -22,7 +22,11 @@ describe("Codecov", function(){ expect(body).to.contain('http://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a'); done(); }, - function(err){ + function(errCode, errMsg){ + if(errCode === 'EAI_AGAIN'){ + console.log('Offline - can not run this test'); + done(); + } throw err; }); }); @@ -39,9 +43,35 @@ describe("Codecov", function(){ expect(body).to.contain('http://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a'); done(); }, - function(err){ + function(errCode, errMsg){ + if(errCode === 'EAI_AGAIN'){ + console.log('Offline - can not run this test'); + done(); + } throw err; }); }); + it("upload v2 doesn't throw runtime error", function(done){ + expect(codecov.sendToCodecovV2.bind(null, + 'https://codecov.io', + { + token: 'f881216b-b5c0-4eb1-8f21-b51887d1d506', + commit: 'c739768fcac68144a3a6d82305b9c4106934d31a', + branch: 'master' + }, + 'testing node-'+codecov.version, + function(body){ + expect(body).to.contain('http://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a'); + done(); + }, + function(errCode, errMsg){ + if(errCode === 'EAI_AGAIN'){ + done(); + } + throw err; + } + )).to.not.throwException(); + }) + });