diff --git a/src/tests/Counter.test.js b/src/tests/Counter.test.js
index 36cc18aa..62f8f153 100644
--- a/src/tests/Counter.test.js
+++ b/src/tests/Counter.test.js
@@ -1,22 +1,25 @@
-// import necessary react testing library helpers here
-// import the Counter component here
-
-beforeEach(() => {
- // Render the Counter component here
-})
+import React from 'react';
+import { render, fireEvent } from '@testing-library/react';
+import Counter from '../components/Counter';
test('renders counter message', () => {
- // Complete the unit test below based on the objective in the line above
+ const { getByText } = render();
+ expect(getByText('Counter')).toBeInTheDocument();
});
test('should render initial count with value of 0', () => {
- // Complete the unit test below based on the objective in the line above
+ const { getByTestId } = render();
+ expect(getByTestId('count')).toHaveTextContent('0');
});
test('clicking + increments the count', () => {
- // Complete the unit test below based on the objective in the line above
+ const { getByTestId, getByText } = render();
+ fireEvent.click(getByText('+'));
+ expect(getByTestId('count')).toHaveTextContent('1');
});
test('clicking - decrements the count', () => {
- // Complete the unit test below based on the objective in the line above
+ const { getByTestId, getByText } = render();
+ fireEvent.click(getByText('-'));
+ expect(getByTestId('count')).toHaveTextContent('-1');
});