btrz-pact-s3
Advanced tools
Comparing version 0.4.7 to 0.4.8
11
index.js
@@ -51,3 +51,3 @@ "use strict"; | ||
ACL: "public-read", | ||
Body: fs.createReadStream(pact) | ||
Body: fs.createReadStream(pact, {encoding: "utf8", autoClose: true}) | ||
}, | ||
@@ -168,3 +168,3 @@ function (err, result) { | ||
if (keysFromProvider.length === 0) { | ||
return reject(new Error(`There are no pacts for the provider ${providerName}`)); | ||
throw new Error(`There are no pacts for the provider ${providerName}`); | ||
} | ||
@@ -175,5 +175,10 @@ | ||
.then((data) => { | ||
if (!data.Body) { | ||
throw new Error(`The file with key ${key} cannot be readed`); | ||
} | ||
let filePath = `${__dirname}/pacts-to-verify/${path.basename(key)}`; | ||
return new Promise((resolve, reject) => { | ||
fs.writeFile(filePath, JSON.stringify(data), "utf8", (err) => { | ||
fs.writeFile(filePath, data.Body, "utf8", (err) => { | ||
if (err) { | ||
@@ -180,0 +185,0 @@ return reject(err); |
{ | ||
"name": "btrz-pact-s3", | ||
"version": "0.4.7", | ||
"version": "0.4.8", | ||
"description": "A consumer-driven Pact library for NodeJs to publish pacts to AWS S3 and verify them", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -159,7 +159,2 @@ "use strict"; | ||
s3Client = new AWS.S3({ | ||
accessKeyId: options.accessKeyId, | ||
secretAccessKey: options.secretAccessKey | ||
}); | ||
sinon.stub(s3Client, "listObjects", (opts) => { | ||
@@ -178,3 +173,3 @@ expect(opts.Bucket).to.be.eql(options.bucket); | ||
return { | ||
promise: function () {return Promise.resolve({testing:true});} | ||
promise: function () {return Promise.resolve({Body: new Buffer("test")});} | ||
}; | ||
@@ -202,7 +197,2 @@ }); | ||
s3Client = new AWS.S3({ | ||
accessKeyId: options.accessKeyId, | ||
secretAccessKey: options.secretAccessKey | ||
}); | ||
sinon.stub(s3Client, "listObjects", (opts) => { | ||
@@ -226,7 +216,2 @@ expect(opts.Bucket).to.be.eql(options.bucket); | ||
s3Client = new AWS.S3({ | ||
accessKeyId: options.accessKeyId, | ||
secretAccessKey: options.secretAccessKey | ||
}); | ||
sinon.stub(s3Client, "listObjects", (opts) => { | ||
@@ -233,0 +218,0 @@ expect(opts.Bucket).to.be.eql(options.bucket); |
20174
557