Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

system test fix #2388

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<Buffer 61 62 63 64 65 66 67 68 69 6a...>",
to: dsname + "(TEST)",
});
expect(Buffer.from(getResponse.toString().trim())).toEqual(data);
});

Expand All @@ -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);
});

Expand Down Expand Up @@ -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": "<Buffer 61 62 63 64 65 66 67 68 69 6a...>","to": ussname});
expect(getResponse).toEqual(Buffer.from(data.toString()));
});

Expand All @@ -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));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
18 changes: 14 additions & 4 deletions packages/zosfiles/src/methods/upload/Upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading