React using NPM and Nginx
Note that yarn
can be used instead of npm
. Feel free to use whichever works for your environment.
Because my React application makes requests to the Spring Boot backend, nginx.conf
was added to set up a reverse proxy.
Spring Boot using Maven
Note that Java Options can added in CMD
.
For example, when I set up an acceptance environment where Product Managers can test to accept or reject stories, I used this as CMD
instead:
CMD ["java", "-Dspring.profiles.active=docker", "-jar", "app.jar"]
When writing unit tests, different people have different ideas on how to assert against whether navigating to a different page was successful or not.
Let’s say I have a main
page that can navigate to a secondary
page. In order to navigate, the implementation needs to use useNavigate
from react-router-dom
.
Here is what MainPage looks like:
My preferred way of writing a unit test for MainPage to navigate to a different page is:
Note that this approach works with React Router v5 with useHistory
as well.
Demo: