How to: :clap: Doing It Right Example: Querying an element using a dedicated attribute for testing
![](https://img.shields.io/badge/🔧%20Example%20using%20React-blue.svg "Examples with React")

```jsx
// the markup code (part of React component)
{value}
```

```javascript
// this example is using react-testing-library
test("Whenever no data is passed to metric, show 0 as default", () => {
  // Arrange
  const metricValue = undefined;

  // Act
  const { getByTestId } = render(
);

  expect(getByTestId("errorsLabel").text()).toBe("0");
});
```