trying to do a test. I want to check if an icon exists when "disabled" is true
DeviceNote.js
import React from 'react';
import PropTypes from 'prop-types';
import { BrightnessAltHighFill, BrightnessAltLow } from 'react-bootstrap-icons';
const DeviceNote = ({ name, description, disabled }) => {
return (
<p>{name}</p>
<p>{description}</p>
{disabled ? (
<BrightnessAltHighFill data-testid="iconTrue" test size={48} />
) : (
<BrightnessAltLow data-testid="iconFalse" size={48} />
)}
);
};
export default DeviceNote;
DeviceNote.test.js
import React from 'react';
import { render } from '@testing-library/react';
import DeviceNote from './DeviceNote';
describe(' Tests for Device Note', () => {
it('Test check Descriptions for Device', () => {
const name = 'defaultValueTitle';
const description = 'defaultValueMail';
const disabled = true;
const { getByTestId, getByText } = render(
<DeviceNote name={name} description={description} disabled={disabled} />,
);
if (disabled) expect(getByTestId('iconTrue')).toBeInTheDocument();
else expect(getByTestId('iconFalse')).toBeInTheDocument();
expect(getByText(name)).toBeInTheDocument();
expect(getByText(description)).toBeInTheDocument();
});
});
When inserted into the bootstrap icon props "data-testid" for test I have a error
console.error Warning: Received `true` for a non-boolean attribute `test`. If you want to write it to the DOM, pass a string instead: test="true" or test={value.toString()}. at svg at E:\Front-React-Driver\react-driver\node_modules\react-bootstrap-icons\build\index.js:5427:20
I don't know what the reason is for