oss-slu / shelter_volunteers

MIT License
2 stars 3 forks source link

Fixed issue #96 added tests for volunteer dashboard #108

Closed cbiddle3 closed 4 months ago

cbiddle3 commented 4 months ago

Fixes #96

What was changed?

Added test cases for the Volunteer Dashboard page to the __tests__ module under the filename 'VolunteerDashboard.test.js' and 'VolunteerDashboardShelterCards.test.js'

Why was it changed?

To ensure with future code changes that the UI is still working properly.

How was it changed?

Added test cases to the aforementioned file.

Important parts:

This function allows you to render the components that have nav links function renderWithRouter(children, routes = []) { const options = isValidElement(children) ? { element: children, path: "/" } : children;

const router = createMemoryRouter([{ ...options }, ...routes], { initialEntries: [options.path], initialIndex: 1, });

return render(); }

Mocking shifts so server calls are not made since the component of the Upcoming Shifts function of Shifts.js isn't what is being tested with this component.