Updated the console's schema page test
@@ -18,31 +18,16 @@ under the License.
*/
import React from "react";
-import { render, fireEvent } from "@testing-library/react";
+import { render } from "@testing-library/react";
import { mockService } from "../../../test_data/qdrService.mock";
import SchemaPage from "./schemaPage";
it("renders a SchemaPage", () => {
const service = mockService({});
const props = {
- schema: service.schema
+ schema: service.schema,
};
- const { getByTestId, queryByTestId } = render(<SchemaPage {...props} />);
-
- // the root node should be present
- const root = getByTestId("entities");
- expect(root).toBeInTheDocument();
-
- // the root node should be expanded by default
- // therefore the address entity should be present
- let addressEntity = getByTestId("address");
- expect(addressEntity).toBeInTheDocument();
-
- fireEvent.click(addressEntity);
- expect(getByTestId("address-egressPhase")).toBeInTheDocument();
-
- // clicking on the root should collapse the tree
- fireEvent.click(root);
- addressEntity = queryByTestId("address");
- expect(addressEntity).toBeNull();
+ const { getByText } = render(<SchemaPage {...props} />);
+ const addressText = getByText(/router.address/);
+ expect(addressText).toBeInTheDocument();
});
