diff --git a/canvas_modules/common-canvas/__tests__/icons/icon-test.js b/canvas_modules/common-canvas/__tests__/icons/icon-test.js
index 8706843135..efb4a37f27 100644
--- a/canvas_modules/common-canvas/__tests__/icons/icon-test.js
+++ b/canvas_modules/common-canvas/__tests__/icons/icon-test.js
@@ -15,7 +15,7 @@
*/
import React from "react";
-import { mount, shallow } from "enzyme";
+import { render } from "@testing-library/react";
import Icon from "../../src/icons/icon.jsx";
import { expect } from "chai";
@@ -23,23 +23,23 @@ import { expect } from "chai";
describe("Icon renders correctly", () => {
it("should render a div when type unknown", () => {
- const icon = shallow();
- expect(icon.find("div")).to.have.length(1);
+ const icon = render();
+ // divs have generic roles, thus when icon is set to unknown, there is supposed to be 2 elements with generic roles
+ expect(icon.getAllByRole("generic")).to.have.length(2);
});
it("should render a svg when type known", () => {
- const icon = mount();
-
- expect(icon.find("svg")).to.have.length(1);
+ const { container } = render();
+ expect(container.getElementsByClassName("canvas-icon")).to.have.length(1);
});
it("should render a svg with class name", () => {
- const icon = mount();
- expect(icon.find("svg.svg-test-class")).to.have.length(1);
+ const { container } = render();
+ expect(container.getElementsByClassName("svg-test-class")).to.have.length(1);
});
it("should render a svg with class 'properties-icon'", () => {
- const icon = mount();
- expect(icon.find("svg.properties-icon")).to.have.length(1);
+ const { container } = render();
+ expect(container.getElementsByClassName("properties-icon")).to.have.length(1);
});
});