From f44cb72ba264ed43a29d4c9ee6dfdce1ec182f5a Mon Sep 17 00:00:00 2001 From: Ibuki Date: Wed, 26 Apr 2023 02:28:02 +0900 Subject: [PATCH] fix: command upload test (#139) --- test/helpers/aws.test.js | 4 +++- test/plugins/commands.test.js | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/helpers/aws.test.js b/test/helpers/aws.test.js index 820e1e7..b21d050 100644 --- a/test/helpers/aws.test.js +++ b/test/helpers/aws.test.js @@ -181,12 +181,14 @@ describe('aws helper test', () => { it('upload command as stream', () => { const uploadParam = { Bucket: testBucket, - Key: `caches/${cacheKey}` + Key: `command/${cacheKey}` }; const uploadOption = { partSize }; + awsClient.segment = 'command'; + return awsClient.uploadCommandAsStream({ cacheKey, payload: Buffer.from('hellow world', 'utf8') }).then(() => { assert.calledWith(clientMock.prototype.upload, sinon.match(uploadParam), sinon.match(uploadOption)); }); diff --git a/test/plugins/commands.test.js b/test/plugins/commands.test.js index f59c848..04140e3 100644 --- a/test/plugins/commands.test.js +++ b/test/plugins/commands.test.js @@ -296,7 +296,6 @@ describe('commands plugin test using s3', () => { let uploadAsStreamMock; let deleteObjMock; let getDownloadMock; - let uploadDirectMock; let data; before(() => { @@ -317,16 +316,13 @@ describe('commands plugin test using s3', () => { uploadAsStreamMock = sinon.stub().resolves(null); deleteObjMock = sinon.stub().resolves(null); getDownloadMock = sinon.stub().resolves(null); - uploadDirectMock = sinon.stub().resolves(null); awsClientMock = sinon.stub().returns({ updateLastModified: sinon.stub().yields(null), removeObject: deleteObjMock, getDownloadStream: getDownloadStreamMock, - uploadCmdAsStream: uploadAsStreamMock, getDownloadObject: getDownloadMock, - uploadAsBuffer: uploadDirectMock, - uploadCommandAsStream: uploadDirectMock + uploadCommandAsStream: uploadAsStreamMock }); data = {