From 5f51da0f99dfcd74ef96715871d9d6cebfafe4e1 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Tue, 19 Sep 2023 10:54:21 -0400 Subject: [PATCH] test(ftp): make test case more specific for FTPS space fix Signed-off-by: Trae Yelovich --- .../__unit__/Mvs/ZoweExplorerFtpMvsApi.unit.test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/zowe-explorer-ftp-extension/__tests__/__unit__/Mvs/ZoweExplorerFtpMvsApi.unit.test.ts b/packages/zowe-explorer-ftp-extension/__tests__/__unit__/Mvs/ZoweExplorerFtpMvsApi.unit.test.ts index ac8fcebdbb..1836670676 100644 --- a/packages/zowe-explorer-ftp-extension/__tests__/__unit__/Mvs/ZoweExplorerFtpMvsApi.unit.test.ts +++ b/packages/zowe-explorer-ftp-extension/__tests__/__unit__/Mvs/ZoweExplorerFtpMvsApi.unit.test.ts @@ -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 } }); @@ -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, ""); @@ -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("");