Skip to content

Commit

Permalink
test(ftp): make test case more specific for FTPS space fix
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Sep 19, 2023
1 parent 72a9770 commit 5f51da0
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const MvsApi = new FtpMvsApi();

describe("FtpMvsApi", () => {
beforeEach(() => {
MvsApi.checkedProfile = jest.fn().mockReturnValue({ message: "success", type: "zftp", failNotFound: false });
MvsApi.checkedProfile = jest.fn().mockReturnValue({ message: "success", type: "zftp", profile: { secureFtp: false }, failNotFound: false });
MvsApi.ftpClient = jest.fn().mockReturnValue({ host: "", user: "", password: "", port: "" });
MvsApi.releaseConnection = jest.fn();
sessionMap.get = jest.fn().mockReturnValue({ mvsListConnection: { connected: true } });
Expand Down Expand Up @@ -123,7 +123,7 @@ describe("FtpMvsApi", () => {
expect(MvsApi.releaseConnection).toBeCalled();
});

it("should upload empty contents to dataset.", async () => {
it("should upload single space to dataset when secureFtp is true and contents are empty", async () => {
const localFile = tmp.tmpNameSync({ tmpdir: "/tmp" });

fs.writeFileSync(localFile, "");
Expand All @@ -138,6 +138,14 @@ describe("FtpMvsApi", () => {
dataSetName: "USER.EMPTYDS",
options: { encoding: "", returnEtag: true, etag: "utf8" },
};
jest.spyOn(MvsApi, "checkedProfile").mockReturnValueOnce({
type: "zftp",
message: "",
profile: {
secureFtp: true,
},
failNotFound: false,
});

jest.spyOn(MvsApi as any, "getContentsTag").mockReturnValue(undefined);
jest.spyOn(fs, "readFileSync").mockReturnValue("");
Expand Down

0 comments on commit 5f51da0

Please sign in to comment.