Bläddra i källkod

Fix `npm run test` command

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
Mihaela Balutoiu 1 år sedan
förälder
incheckning
f9c0671314

+ 2 - 2
src/components/modules/DashboardModule/DashboardActivity/DashboardActivity.spec.tsx

@@ -101,9 +101,9 @@ describe("DashboardActivity", () => {
     expect(background).toContain(expectedStatusIcon);
 
     expect(
-      TestUtils.select("NotificationDropdown__ItemReplicaBadge", itemElement)!
+      TestUtils.select("NotificationDropdown__ItemTransferBadge", itemElement)!
         .textContent
-    ).toContain(ITEMS[idx].type === "replica" ? "RE" : "MI");
+    ).toContain(ITEMS[idx].type === "transfer" ? "TR" : "DE");
     expect(
       TestUtils.select("NotificationDropdown__ItemTitle", itemElement)!
         .textContent

+ 3 - 3
src/components/modules/DashboardModule/DashboardExecutions/DashboardExecutions.spec.tsx

@@ -52,8 +52,8 @@ const replicas: DashboardExecutions["props"]["replicas"] = [
 ];
 
 const migrations: DashboardExecutions["props"]["migrations"] = [
-  transferItem("migration", TWENTIETH.toISO()!),
-  transferItem("migration", TWENTIETH.minus({ months: 2 }).toISO()!),
+  transferItem("live_migration", TWENTIETH.toISO()!),
+  transferItem("live_migration", TWENTIETH.minus({ months: 2 }).toISO()!),
 ];
 
 describe("DashboardExecutions", () => {
@@ -240,6 +240,6 @@ describe("DashboardExecutions", () => {
       ],
     };
     render(<DashboardExecutions {...newProps} />);
-    expect(TestUtils.selectAll("DashboardBarChart__Bar-")).toHaveLength(1);
+    expect(TestUtils.selectAll("DashboardBarChart__Bar-")).toHaveLength(2);
   });
 });

+ 3 - 3
src/components/modules/DashboardModule/DashboardLicence/DashboardLicence.spec.tsx

@@ -68,14 +68,14 @@ describe("DashboardLicence", () => {
     expect(
       TestUtils.selectAll("DashboardLicence__ChartHeaderCurrent-")[0]
         .textContent
-    ).toBe("5 Fulfilled Replicas ");
+    ).toBe("5 Used Replicas ");
     expect(
       TestUtils.selectAll("DashboardLicence__ChartHeaderTotal-")[0].textContent
     ).toBe("Total 10");
     expect(
       TestUtils.selectAll("DashboardLicence__ChartHeaderCurrent-")[1]
         .textContent
-    ).toBe("3 Fulfilled Migrations ");
+    ).toBe("3 Used Migrations ");
     expect(
       TestUtils.selectAll("DashboardLicence__ChartHeaderTotal-")[1].textContent
     ).toBe("Total 5");
@@ -178,6 +178,6 @@ describe("DashboardLicence", () => {
     expect(
       TestUtils.selectAll("DashboardLicence__ChartHeaderCurrent-")[0]
         .textContent
-    ).toBe("1 Fulfilled Replica ");
+    ).toBe("1 Used Replica ");
   });
 });

+ 2 - 2
src/components/modules/DashboardModule/DashboardTopEndpoints/DashboardTopEndpoints.spec.tsx

@@ -136,11 +136,11 @@ describe("DashboardTopEndpoints", () => {
       TestUtils.selectAll(
         "DashboardTopEndpoints__LegendLabel-"
       )[0].attributes.getNamedItem("to")?.value
-    ).toBe("/endpoints/e");
+    ).toBe("/endpoints/a");
 
     expect(
       TestUtils.selectAll("DashboardTopEndpoints__LegendLabel-")[1].textContent
-    ).toBe("f-name");
+    ).toBe("b-name");
   });
 
   it("should call calculateGroupedEndpoints when component receives new props", () => {

+ 1 - 1
src/components/modules/LicenceModule/LicenceModule.spec.tsx

@@ -155,7 +155,7 @@ Version: 2.0
 
     expect(
       TestUtils.select("LicenceModule__LicenceRowContent")?.textContent
-    ).toContain("Please contact Cloudbase Solutions");
+    ).toContain("Please contact your Coriolis representative");
   });
 
   it("renders licence error", () => {

+ 5 - 5
src/components/modules/TransferModule/DeleteTransferModal/DeleteReplicaModal.spec.tsx

@@ -19,7 +19,7 @@ import TestUtils from "@tests/TestUtils";
 
 import DeleteTransferModal from "./DeleteTransferModal";
 
-describe("DeleteReplicaModal", () => {
+describe("DeleteTransferModal", () => {
   let defaultProps: DeleteTransferModal["props"];
 
   beforeEach(() => {
@@ -33,13 +33,13 @@ describe("DeleteReplicaModal", () => {
 
   it("renders without crashing", () => {
     const { getByText } = render(<DeleteTransferModal {...defaultProps} />);
-    expect(getByText("Delete Replica")).toBeTruthy();
+    expect(getByText("Delete Transfer")).toBeTruthy();
   });
 
   it("renders with disks", () => {
     render(<DeleteTransferModal {...defaultProps} hasDisks />);
     expect(
-      TestUtils.select("DeleteReplicaModal__ExtraMessage")?.textContent
+      TestUtils.select("DeleteTransferModal__ExtraMessage")?.textContent
     ).toContain("has been executed at least once");
   });
 
@@ -52,12 +52,12 @@ describe("DeleteReplicaModal", () => {
       />
     );
     expect(
-      TestUtils.select("DeleteReplicaModal__ExtraMessage")?.textContent
+      TestUtils.select("DeleteTransferModal__ExtraMessage")?.textContent
     ).toContain("have been executed at least once");
   });
 
   it("renders loading", () => {
     render(<DeleteTransferModal {...defaultProps} loading />);
-    expect(TestUtils.select("DeleteReplicaModal__Loading")).toBeTruthy();
+    expect(TestUtils.select("DeleteTransferModal__Loading")).toBeTruthy();
   });
 });

+ 1 - 1
src/components/modules/TransferModule/Executions/Executions.spec.tsx

@@ -79,7 +79,7 @@ describe("Executions", () => {
     expect(getByText(EXECUTION_MOCK.id)).toBeTruthy();
 
     rerender(<Executions {...defaultProps} executions={[]} />);
-    expect(getByText("This replica has not been executed yet.")).toBeTruthy();
+    expect(getByText("This transfer has not been executed yet.")).toBeTruthy();
   });
 
   it("doesn't dispatch onChange if no executions", () => {

+ 2 - 2
src/components/modules/TransferModule/Executions/Executions.tsx

@@ -412,10 +412,10 @@ class Executions extends React.Component<Props, State> {
       <NoExecutions>
         <ExecutionImage />
         <NoExecutionTitle>
-          It looks like there are no executions in this tranfer.
+          It looks like there are no executions in this transfer.
         </NoExecutionTitle>
         <NoExecutionText>
-          This tranfer has not been executed yet.
+          This transfer has not been executed yet.
         </NoExecutionText>
         <Button onClick={this.props.onExecuteClick}>Execute Now</Button>
       </NoExecutions>

+ 3 - 3
src/components/modules/TransferModule/Schedule/Schedule.spec.tsx

@@ -99,7 +99,7 @@ describe("Schedule", () => {
     expect(TestUtils.select("Modal__Title-")?.textContent).toBe(
       "Execution options"
     );
-    const modal = TestUtils.select("ReplicaExecutionOptions__Wrapper-")!;
+    const modal = TestUtils.select("TransferExecutionOptions__Wrapper-")!;
     TestUtils.select("Switch__InputWrapper-", modal)?.click();
     const yesButton = Array.from(modal.querySelectorAll("button")).find(
       el => el.textContent === "Save"
@@ -123,7 +123,7 @@ describe("Schedule", () => {
     expect(TestUtils.select("Modal__Title-")?.textContent).toBe(
       "Execution options"
     );
-    const modal = TestUtils.select("ReplicaExecutionOptions__Wrapper-")!;
+    const modal = TestUtils.select("TransferExecutionOptions__Wrapper-")!;
     const noButton = Array.from(modal.querySelectorAll("button")).find(
       el => el.textContent === "Cancel"
     );
@@ -216,7 +216,7 @@ describe("Schedule", () => {
   it("renders secondary no schedules", () => {
     render(<Schedule {...defaultProps} schedules={[]} secondaryEmpty />);
     expect(TestUtils.select("Schedule__NoSchedules-")?.textContent).toContain(
-      "Schedule this Replica"
+      "Schedule this Transfer"
     );
   });
 

+ 3 - 4
src/components/ui/Dropdowns/NewItemDropdown/NewItemDropdown.spec.tsx

@@ -34,7 +34,7 @@ describe("NewItemDropdown", () => {
     TestUtils.select("DropdownButton__Wrapper")!.click();
     TestUtils.selectAll("NewItemDropdown__ListItem")[2].click();
     expect(onChange).toBeCalledWith(
-      expect.objectContaining({ value: "endpoint" })
+      expect.objectContaining({ value: "minionPool" })
     );
   });
 
@@ -42,8 +42,7 @@ describe("NewItemDropdown", () => {
     render(<NewItemDropdown onChange={() => {}} />);
     TestUtils.select("DropdownButton__Wrapper")!.click();
     const listItems = TestUtils.selectAll("NewItemDropdown__ListItem");
-    expect(listItems[0].getAttribute("to")).toBe("/wizard/migration");
-    expect(listItems[1].getAttribute("to")).toBe("/wizard/replica");
-    expect(listItems[2].getAttribute("to")).toBe("#");
+    expect(listItems[0].getAttribute("to")).toBe("/wizard/replica");
+    expect(listItems[1].getAttribute("to")).toBe("#");
   });
 });

+ 5 - 5
src/components/ui/Dropdowns/NotificationDropdown/NotificationDropdown.spec.tsx

@@ -24,14 +24,14 @@ jest.mock("react-router-dom", () => ({ Link: "div" }));
 const ITEMS: NotificationItemData[] = [
   {
     id: "1",
-    type: "migration",
+    type: "transfer",
     name: "Notification 1",
     description: "Description 1",
     status: "COMPLETED",
   },
   {
     id: "2",
-    type: "replica",
+    type: "transfer",
     name: "Notification 2",
     description: "Description 2",
     status: "ERROR",
@@ -39,7 +39,7 @@ const ITEMS: NotificationItemData[] = [
   },
   {
     id: "3",
-    type: "replica",
+    type: "transfer",
     name: "Notification 3",
     description: "Description 3",
     status: "RUNNING",
@@ -66,9 +66,9 @@ describe("NotificationDropdown", () => {
       `/${ITEMS[2].type}s/${ITEMS[2].id}/executions`
     );
     expect(
-      TestUtils.select("NotificationDropdown__ItemReplicaBadge", listItems[2])!
+      TestUtils.select("NotificationDropdown__ItemTransferBadge", listItems[2])!
         .textContent
-    ).toBe("RE");
+    ).toBe("TR");
     expect(
       TestUtils.select("NotificationDropdown__ItemTitle", listItems[2])!
         .textContent