diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000..13566b81
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/counter-assignment.iml b/.idea/counter-assignment.iml
new file mode 100644
index 00000000..d6ebd480
--- /dev/null
+++ b/.idea/counter-assignment.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..6f29fee2
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..dac74155
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
new file mode 100644
index 00000000..f324872a
--- /dev/null
+++ b/.idea/php.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..35eb1ddf
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/tests/Counter.test.js b/src/tests/Counter.test.js
index 36cc18aa..3f571d53 100644
--- a/src/tests/Counter.test.js
+++ b/src/tests/Counter.test.js
@@ -1,22 +1,31 @@
-// import necessary react testing library helpers here
-// import the Counter component here
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import Counter from '../components/Counter';
beforeEach(() => {
- // Render the Counter component here
-})
+ render();
+});
test('renders counter message', () => {
- // Complete the unit test below based on the objective in the line above
+ const counterMessage = screen.getByText(/Counter/i);
+ expect(counterMessage).toBeInTheDocument();
});
test('should render initial count with value of 0', () => {
- // Complete the unit test below based on the objective in the line above
+ const counterValue = screen.getByTestId('count');
+ expect(counterValue).toHaveTextContent('0');
});
test('clicking + increments the count', () => {
- // Complete the unit test below based on the objective in the line above
+ const incrementButton = screen.getByRole('button', { name: /\+/i });
+ userEvent.click(incrementButton);
+ const counterValue = screen.getByTestId('count');
+ expect(counterValue).toHaveTextContent('1');
});
test('clicking - decrements the count', () => {
- // Complete the unit test below based on the objective in the line above
+ const decrementButton = screen.getByRole('button', { name: /-/i });
+ userEvent.click(decrementButton);
+ const counterValue = screen.getByTestId('count');
+ expect(counterValue).toHaveTextContent('-1');
});