diff --git a/packages/zosfiles/__tests__/__system__/methods/upload/Upload.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/upload/Upload.system.test.ts index adeaa4f699..b93d74db4c 100644 --- a/packages/zosfiles/__tests__/__system__/methods/upload/Upload.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/upload/Upload.system.test.ts @@ -326,7 +326,11 @@ describe("Upload Data Set", () => { expect(error).toBeFalsy(); - expect(uploadResponse.apiResponse).toMatchObject({"success": true, "from": "Buffer<>","to": dsname+"(TEST)"}); + expect(uploadResponse.apiResponse).toMatchObject({ + success: true, + from: "", + to: dsname + "(TEST)", + }); expect(Buffer.from(getResponse.toString().trim())).toEqual(data); }); @@ -349,7 +353,7 @@ describe("Upload Data Set", () => { expect(error).toBeFalsy(); - expect(uploadResponse.apiResponse).toMatchObject({"success": true, "from": "Stream<>","to": dsname+"(TEST)"}); + expect(uploadResponse.apiResponse).toMatchObject({"success": true, "from": "[Readable]","to": dsname+"(TEST)"}); expect(getResponse.toString().trim()).toEqual(testdata); }); @@ -793,7 +797,7 @@ describe("Upload USS file", () => { expect(error).toBeFalsy(); - expect(uploadResponse.apiResponse).toMatchObject({"success": true, "from": "Buffer<>","to": ussname}); + expect(uploadResponse.apiResponse).toMatchObject({"success": true, "from": "","to": ussname}); expect(getResponse).toEqual(Buffer.from(data.toString())); }); @@ -815,7 +819,7 @@ describe("Upload USS file", () => { expect(error).toBeFalsy(); - expect(uploadResponse.apiResponse).toMatchObject({"success": true, "from": "Stream<>","to": ussname}); + expect(uploadResponse.apiResponse).toMatchObject({"success": true, "from": "[Readable]","to": ussname}); expect(getResponse).toEqual(Buffer.from(testdata)); }); diff --git a/packages/zosfiles/__tests__/__unit__/methods/upload/Upload.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/upload/Upload.unit.test.ts index c0f92eb905..3e758ae690 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/upload/Upload.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/upload/Upload.unit.test.ts @@ -22,7 +22,6 @@ import { IUploadOptions } from "../../../../src/methods/upload/doc/IUploadOption import { Upload } from "../../../../src/methods/upload/Upload"; import { List } from "../../../../src/methods/list/List"; import { Utilities } from "../../../../src/methods/utilities/Utilities"; -import { inspect } from "util"; import { ZosFilesUtils } from "../../../../src/utils/ZosFilesUtils"; import { stripNewLines } from "../../../../../../__tests__/__src__/TestUtils"; import { Create } from "../../../../src/methods/create"; diff --git a/packages/zosfiles/src/methods/upload/Upload.ts b/packages/zosfiles/src/methods/upload/Upload.ts index 9301c81bfc..af363ef988 100644 --- a/packages/zosfiles/src/methods/upload/Upload.ts +++ b/packages/zosfiles/src/methods/upload/Upload.ts @@ -187,8 +187,13 @@ export class Upload { // By default, apiResponse is empty when uploading const apiResponse: any = { success: true, - from: fileBuffer.length > maxBufferPreviewSize ? inspect(fileBuffer.subarray(0, maxBufferPreviewSize)).slice(0, -1) + "...>" : inspect(fileBuffer), - to: dataSetName + from: + fileBuffer.length > maxBufferPreviewSize + ? inspect( + fileBuffer.subarray(0, maxBufferPreviewSize) + ).slice(0, -1) + "...>" + : inspect(fileBuffer), + to: dataSetName, }; // Return Etag in apiResponse, if requested @@ -493,8 +498,13 @@ export class Upload { // By default, apiResponse is empty when uploading const apiResponse: any = { success: true, - from: fileBuffer.length > maxBufferPreviewSize ? inspect(fileBuffer.subarray(0, maxBufferPreviewSize)).slice(0, -1) + "...>" : inspect(fileBuffer), - to: origUssname + from: + fileBuffer.length > maxBufferPreviewSize + ? inspect( + fileBuffer.subarray(0, maxBufferPreviewSize) + ).slice(0, -1) + "...>" + : inspect(fileBuffer), + to: origUssname, }; // Return Etag in apiResponse, if requested