ui-neu
Version:
Neu UI, a responsive React component library.
35 lines • 1.17 kB
JavaScript
import React from "react";
import { act } from "react-dom/test-utils";
import { render, unmountComponentAtNode } from "react-dom";
import { CardImg } from "./CardImg";
describe("CardImg test suite", function () {
var container = null;
beforeEach(function () {
container = document.createElement("div");
document.body.appendChild(container);
});
afterEach(function () {
unmountComponentAtNode(container);
container.remove();
container = null;
});
it("renders CardImg props", function () {
act(function () {
render( /*#__PURE__*/React.createElement(CardImg, {
src: "test-src",
alt: "test-alt"
}), container);
});
expect(document.querySelector('[src="test-src"]')).toBeTruthy();
expect(document.querySelector('[alt="test-alt"]')).toBeTruthy();
});
it('renders CardImg "alt" prop with default value', function () {
act(function () {
render( /*#__PURE__*/React.createElement(CardImg, {
src: "test-src"
}), container);
});
expect(document.querySelector('[src="test-src"]')).toBeTruthy();
expect(document.querySelector('[alt="null"]')).toBeTruthy();
});
});