Skip to content

Commit

Permalink
Merge branch 'master' into 478-copy-paste-labels-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zFernand0 authored Feb 20, 2020
2 parents 3dcd6ec + 84a7b78 commit 6eead9e
Show file tree
Hide file tree
Showing 46 changed files with 1,229 additions and 537 deletions.
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

4 changes: 2 additions & 2 deletions __mocks__/@brightside/core.ts → __mocks__/@zowe/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

import { Session } from "../Session";
import { IListOptions } from "@brightside/core";
import * as imperative from "../@brightside/imperative";
import { IListOptions } from "@zowe/cli";
import * as imperative from "./imperative";

// tslint:disable-next-line:no-namespace
export namespace ZosmfSession {
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions __mocks__/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
* *
*/

import { AbstractSession } from "@brightside/imperative/lib/rest/src/session/AbstractSession";
import { ISession } from "@brightside/imperative/lib/rest/src/session/doc/ISession";
import { AbstractSession, ISession } from "@zowe/imperative";

/**
* Non-abstract session class
Expand Down
9 changes: 4 additions & 5 deletions __tests__/__integration__/DatasetTree.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
*/

// tslint:disable:no-magic-numbers
import * as zowe from "@brightside/core";
import { Logger, IProfileLoaded } from "@brightside/imperative";
// tslint:disable-next-line:no-implicit-dependencies
import * as zowe from "@zowe/cli";
import { IProfileLoaded } from "@zowe/imperative";
import * as expect from "expect";
import * as vscode from "vscode";
import { DatasetTree } from "../../src/DatasetTree";
Expand All @@ -22,7 +21,7 @@ import * as sinon from "sinon";
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as extension from "../../src/extension";
import { Profiles } from "../../src/Profiles";

declare var it: any;

const testProfile: IProfileLoaded = {
Expand All @@ -36,7 +35,7 @@ const testProfile: IProfileLoaded = {
describe("DatasetTree Integration Tests", async () => {
const TIMEOUT = 120000;
chai.use(chaiAsPromised);
// Uses loaded profile to create a zosmf session with brightside
// Uses loaded profile to create a zosmf session with Zowe
const session = zowe.ZosmfSession.createBasicZosmfSession(testConst.profile);
const sessNode = new ZoweDatasetNode(testConst.profile.name, vscode.TreeItemCollapsibleState.Expanded,
null, session, undefined, undefined, testProfile);
Expand Down
8 changes: 4 additions & 4 deletions __tests__/__integration__/USSTree.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

// tslint:disable:no-magic-numbers
import * as zowe from "@brightside/core";
import { Logger, IProfileLoaded } from "@brightside/imperative";
import * as zowe from "@zowe/cli";
import { Logger, IProfileLoaded } from "@zowe/imperative";
import * as chai from "chai";
import * as sinon from "sinon";
import * as chaiAsPromised from "chai-as-promised";
Expand All @@ -22,7 +22,7 @@ import * as testConst from "../../resources/testProfileData";
import { USSTree } from "../../src/USSTree";
import { ZoweUSSNode } from "../../src/ZoweUSSNode";
import * as extension from "../../src/extension";
import { Profiles } from "../../src/Profiles";

declare var it: any;

const testProfile: IProfileLoaded = {
Expand All @@ -37,7 +37,7 @@ describe("USSTree Integration Tests", async () => {
const TIMEOUT = 120000;
chai.use(chaiAsPromised);

// Uses loaded profile to create a zosmf session with brightside
// Uses loaded profile to create a zosmf session with Zowe
const session = zowe.ZosmfSession.createBasicZosmfSession(testConst.profile);
const sessNode = new ZoweUSSNode(testConst.profile.name, vscode.TreeItemCollapsibleState.Expanded,
null, session, "", false, testProfile.name);
Expand Down
8 changes: 4 additions & 4 deletions __tests__/__integration__/ZoweNode.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* *
*/

import * as zowe from "@brightside/core";
import { Logger, IProfileLoaded } from "@brightside/imperative";
import * as zowe from "@zowe/cli";
import { IProfileLoaded } from "@zowe/imperative";
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
// tslint:disable-next-line:no-implicit-dependencies
Expand All @@ -19,7 +19,7 @@ import * as vscode from "vscode";
import { ZoweDatasetNode } from "../../src/ZoweDatasetNode";
import * as testConst from "../../resources/testProfileData";
import * as extension from "../../src/extension";
import { Profiles } from "../../src/Profiles";

declare var it: any;

const testProfile: IProfileLoaded = {
Expand All @@ -34,7 +34,7 @@ describe("ZoweNode Integration Tests", async () => {
const TIMEOUT = 120000;
chai.use(chaiAsPromised);

// Uses loaded profile to create a zosmf session with brightside
// Uses loaded profile to create a zosmf session with Zowe
const session = zowe.ZosmfSession.createBasicZosmfSession(testConst.profile);
const sessNode = new ZoweDatasetNode(testConst.profile.name, vscode.TreeItemCollapsibleState.Expanded,
null, session, undefined, undefined, testProfile);
Expand Down
7 changes: 3 additions & 4 deletions __tests__/__integration__/ZoweUSSNode.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* *
*/

import * as zowe from "@brightside/core";
import { Logger, IProfileLoaded } from "@brightside/imperative";
import * as zowe from "@zowe/cli";
import { IProfileLoaded } from "@zowe/imperative";
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
// tslint:disable-next-line:no-implicit-dependencies
Expand All @@ -19,7 +19,6 @@ import * as vscode from "vscode";
import { ZoweUSSNode } from "../../src/ZoweUSSNode";
import * as testConst from "../../resources/testProfileData";
import * as extension from "../../src/extension";
import { Profiles } from "../../src/Profiles";

declare var it: any;

Expand All @@ -35,7 +34,7 @@ describe("ZoweUSSNode Integration Tests", async () => {
const TIMEOUT = 120000;
chai.use(chaiAsPromised);

// Uses loaded profile to create a zosmf session with brightside
// Uses loaded profile to create a zosmf session with Zowe
const session = zowe.ZosmfSession.createBasicZosmfSession(testConst.profile);
const sessNode = new ZoweUSSNode(testConst.profile.name, vscode.TreeItemCollapsibleState.Expanded, null, session, null, false, testProfile.name);
sessNode.contextValue = extension.USS_SESSION_CONTEXT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* *
*/

import * as zowe from "@brightside/core";
import * as zowe from "@zowe/cli";
import * as sinon from "sinon";
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
Expand Down
30 changes: 15 additions & 15 deletions __tests__/__integration__/extension.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

// tslint:disable:no-magic-numbers
import * as zowe from "@brightside/core";
import { Logger, CliProfileManager, IProfileLoaded } from "@brightside/imperative";
import * as zowe from "@zowe/cli";
import { Logger, CliProfileManager, IProfileLoaded } from "@zowe/imperative";
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as extension from "../../src/extension";
Expand Down Expand Up @@ -163,7 +163,7 @@ describe("Extension Integration Tests", () => {
describe("Deactivate", () => {
it("should clean up the local files when deactivate is invoked", async () => {
try {
fs.mkdirSync(extension.BRIGHTTEMPFOLDER);
fs.mkdirSync(extension.ZOWETEMPFOLDER);
fs.mkdirSync(extension.DS_DIR);
} catch (err) {
// if operation failed, wait a second and try again
Expand Down Expand Up @@ -338,10 +338,10 @@ describe("Extension Integration Tests", () => {

const changedData = "PS Upload Test";

fs.writeFileSync(path.join(extension.BRIGHTTEMPFOLDER, children[1].label + "[" + profiles[1].label + "]"), changedData);
fs.writeFileSync(path.join(extension.ZOWETEMPFOLDER, children[1].label + "[" + profiles[1].label + "]"), changedData);

// Upload file
const doc = await vscode.workspace.openTextDocument(path.join(extension.BRIGHTTEMPFOLDER,
const doc = await vscode.workspace.openTextDocument(path.join(extension.ZOWETEMPFOLDER,
children[1].label + "[" + profiles[1].label + "]"));
await extension.saveFile(doc, testTree);

Expand All @@ -352,7 +352,7 @@ describe("Extension Integration Tests", () => {

// Change contents back
const originalData = "";
fs.writeFileSync(path.join(path.join(extension.BRIGHTTEMPFOLDER, children[1].label)), originalData);
fs.writeFileSync(path.join(path.join(extension.ZOWETEMPFOLDER, children[1].label)), originalData);
}).timeout(TIMEOUT);

it("should download, change, and re-upload a PDS member", async () => {
Expand All @@ -368,10 +368,10 @@ describe("Extension Integration Tests", () => {

const changedData2 = "PO Member Upload Test";

fs.writeFileSync(path.join(extension.BRIGHTTEMPFOLDER, children[0].label + "(" + childrenMembers[0].label + ")"), changedData2);
fs.writeFileSync(path.join(extension.ZOWETEMPFOLDER, children[0].label + "(" + childrenMembers[0].label + ")"), changedData2);

// Upload file
const doc2 = await vscode.workspace.openTextDocument(path.join(extension.BRIGHTTEMPFOLDER, children[0].label +
const doc2 = await vscode.workspace.openTextDocument(path.join(extension.ZOWETEMPFOLDER, children[0].label +
"(" + childrenMembers[0].label + ")"));
extension.saveFile(doc2, testTree);

Expand All @@ -382,7 +382,7 @@ describe("Extension Integration Tests", () => {

// Change contents back
const originalData2 = "";
fs.writeFileSync(path.join(extension.BRIGHTTEMPFOLDER, children[0].label + "(" + childrenMembers[0].label + ")"), originalData2);
fs.writeFileSync(path.join(extension.ZOWETEMPFOLDER, children[0].label + "(" + childrenMembers[0].label + ")"), originalData2);
}).timeout(TIMEOUT);

// TODO add tests for saving data set from favorites
Expand Down Expand Up @@ -761,8 +761,8 @@ describe("Extension Integration Tests", () => {
await vscode.workspace.getConfiguration().update("Zowe-Temp-Folder-Location",
{ folderPath: `${testingPath}` }, vscode.ConfigurationTarget.Global);

// expect(extension.BRIGHTTEMPFOLDER).to.equal(`${testingPath}/temp`);
expect(extension.BRIGHTTEMPFOLDER).to.equal(path.join(testingPath, "temp"));
// expect(extension.ZOWETEMPFOLDER).to.equal(`${testingPath}/temp`);
expect(extension.ZOWETEMPFOLDER).to.equal(path.join(testingPath, "temp"));

// Remove directory for subsequent tests
extension.cleanDir(testingPath);
Expand All @@ -780,8 +780,8 @@ describe("Extension Integration Tests", () => {
await vscode.workspace.getConfiguration().update("Zowe-Temp-Folder-Location",
{ folderPath: `${providedPathTwo}` }, vscode.ConfigurationTarget.Global);

// expect(extension.BRIGHTTEMPFOLDER).to.equal(`${providedPathTwo}/temp`);
expect(extension.BRIGHTTEMPFOLDER).to.equal(path.join(providedPathTwo, "temp"));
// expect(extension.ZOWETEMPFOLDER).to.equal(`${providedPathTwo}/temp`);
expect(extension.ZOWETEMPFOLDER).to.equal(path.join(providedPathTwo, "temp"));

// Remove directory for subsequent tests
extension.cleanDir(providedPathOne);
Expand All @@ -792,7 +792,7 @@ describe("Extension Integration Tests", () => {
const expectedDefaultTemp = path.join(__dirname, "..", "..", "..", "resources", "temp");
await vscode.workspace.getConfiguration().update("Zowe-Temp-Folder-Location",
{ folderPath: "" }, vscode.ConfigurationTarget.Global);
expect(extension.BRIGHTTEMPFOLDER).to.equal(expectedDefaultTemp);
expect(extension.ZOWETEMPFOLDER).to.equal(expectedDefaultTemp);
}).timeout(TIMEOUT);
});

Expand Down Expand Up @@ -952,7 +952,7 @@ describe("Extension Integration Tests - USS", () => {
describe("Deactivate", () => {
it("should clean up the local files when deactivate is invoked", async () => {
try {
fs.mkdirSync(extension.BRIGHTTEMPFOLDER);
fs.mkdirSync(extension.ZOWETEMPFOLDER);
fs.mkdirSync(extension.USS_DIR);
} catch (err) {
// if operation failed, wait a second and try again
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

// tslint:disable:no-magic-numbers
import * as zowe from "@brightside/core";
import { Logger, IProfileLoaded } from "@brightside/imperative";
import * as zowe from "@zowe/cli";
import { Logger, IProfileLoaded } from "@zowe/imperative";
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as sinon from "sinon";
Expand All @@ -20,7 +20,6 @@ import * as vscode from "vscode";
import { USSTree } from "../../../src/USSTree";
import { ZoweUSSNode } from "../../../src/ZoweUSSNode";
import * as extension from "../../../src/extension";
import { Profiles } from "../../../src/Profiles";

const TIMEOUT = 45000;
declare var it: Mocha.ITestDefinition;
Expand Down
8 changes: 4 additions & 4 deletions __tests__/__unit__/DatasetTree.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jest.mock("vscode");
jest.mock("fs");
jest.mock("util");
jest.mock("Session");
jest.mock("@brightside/core");
jest.mock("@brightside/imperative");
jest.mock("@zowe/imperative");
jest.mock("isbinaryfile");
jest.mock("../../src/Profiles");

import * as vscode from "vscode";
import { DatasetTree } from "../../src/DatasetTree";
import { ZoweDatasetNode } from "../../src/ZoweDatasetNode";
import { Session, Logger, IProfileLoaded } from "@brightside/imperative";
import * as zowe from "@brightside/core";
import { Session, Logger, IProfileLoaded } from "@zowe/imperative";
import * as zowe from "@zowe/cli";
import * as utils from "../../src/utils";
import { Profiles } from "../../src/Profiles";
import * as extension from "../../src/extension";
Expand Down
7 changes: 3 additions & 4 deletions __tests__/__unit__/Profiles.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@

jest.mock("vscode");
jest.mock("child_process");
import { Logger, ISession, ImperativeConfig } from "@brightside/imperative";
import * as path from "path";
import * as os from "os";
import * as child_process from "child_process";
import * as vscode from "vscode";
import * as child_process from "child_process";
import { Logger, ISession } from "@zowe/imperative";
import { Profiles } from "../../src/Profiles";

import { ZosmfSession } from "@brightside/core";
import { ZosmfSession } from "@zowe/cli";

describe("Profile class unit tests", () => {
// Mocking log.debug
Expand Down
10 changes: 5 additions & 5 deletions __tests__/__unit__/SpoolProvider.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
*/

import * as spoolprovider from "../../src/SpoolProvider";
import * as brightside from "@brightside/core";
import * as imperative from "@brightside/imperative";
import * as zowe from "@zowe/cli";
import { IProfileLoaded } from "@zowe/imperative";
import * as vscode from "vscode";
import { Profiles } from "../../src/Profiles";

describe("SpoolProvider Unit Tests", () => {
const iJobFile: brightside.IJobFile = {
const iJobFile: zowe.IJobFile = {
"byte-count": 128,
"job-correlator": "",
"record-count": 1,
Expand Down Expand Up @@ -98,7 +98,7 @@ describe("SpoolProvider Unit Tests", () => {
it("Tests that the spool content is returned", () => {
const GetJobs = jest.fn();
const getSpoolContentById = jest.fn();
const profileOne: imperative.IProfileLoaded = {
const profileOne: IProfileLoaded = {
name: "sessionName",
profile: {
user:undefined,
Expand All @@ -119,7 +119,7 @@ describe("SpoolProvider Unit Tests", () => {
};
})
});
Object.defineProperty(brightside, "GetJobs", { value: GetJobs });
Object.defineProperty(zowe, "GetJobs", { value: GetJobs });
Object.defineProperty(GetJobs, "getSpoolContentById", { value: getSpoolContentById });
getSpoolContentById.mockReturnValue("spool content");

Expand Down
15 changes: 8 additions & 7 deletions __tests__/__unit__/USSTree.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

// tslint:disable:no-shadowed-variable
jest.mock("vscode");
jest.mock("@brightside/imperative");
jest.mock("@brightside/core/lib/zosfiles/src/api/methods/list/doc/IListOptions");
jest.mock("@zowe/imperative");
jest.mock("Session");
jest.mock("../../src/Profiles");
import * as brightside from "@brightside/core";
import { Session, Logger, IProfileLoaded } from "@brightside/imperative";

import * as zowe from "@zowe/cli";
import { Session, Logger, IProfileLoaded } from "@zowe/imperative";
import * as vscode from "vscode";
import { USSTree, createUSSTree } from "../../src/USSTree";
import * as utils from "../../src/utils";
Expand Down Expand Up @@ -702,7 +702,7 @@ describe("Unit Tests (Jest)", () => {
type: "basic",
});
const ZosmfSession = jest.fn();
Object.defineProperty(brightside, "ZosmfSession", { value: ZosmfSession });
Object.defineProperty(zowe, "ZosmfSession", { value: ZosmfSession });
const createBasicZosmfSession = jest.fn();
Object.defineProperty(ZosmfSession, "createBasicZosmfSession", { value: createBasicZosmfSession });
createBasicZosmfSession.mockReturnValue(sessionwocred);
Expand Down Expand Up @@ -778,11 +778,12 @@ describe("Unit Tests (Jest)", () => {
type: "basic",
});
const ZosmfSession = jest.fn();
Object.defineProperty(brightside, "ZosmfSession", { value: ZosmfSession });
Object.defineProperty(zowe, "ZosmfSession", { value: ZosmfSession });
const createBasicZosmfSession = jest.fn();
Object.defineProperty(ZosmfSession, "createBasicZosmfSession", { value: createBasicZosmfSession });
createBasicZosmfSession.mockReturnValue(sessionwocred);
const dsNode = new ZoweUSSNode("[ussTestSess2]: /u/myFile.txt", vscode.TreeItemCollapsibleState.Expanded, null, sessionwocred, null, false, "ussTestSess2");
const dsNode = new ZoweUSSNode(
"[ussTestSess2]: /u/myFile.txt", vscode.TreeItemCollapsibleState.Expanded, null, sessionwocred, null, false, "ussTestSess2");
Object.defineProperty(Profiles, "getInstance", {
value: jest.fn(() => {
return {
Expand Down
Loading

0 comments on commit 6eead9e

Please sign in to comment.