Skip to content

Conversation

@RoyEJohnson
Copy link
Contributor

@RoyEJohnson RoyEJohnson commented Oct 6, 2025

@RoyEJohnson RoyEJohnson force-pushed the core-1268-review-portal-routing-and-tests branch from 0689635 to a3897b7 Compare October 6, 2025 21:17
"setupFiles": [
"<rootDir>/test/setupFile.js"
],
"maxWorkers": "60%",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was to help some flaky tests succeed. I'm not sure whether it helped, but I think it did.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diffs were too many to show changes. :(

function useLoading(name) {
const {pathname} = useLocation();

return React.useCallback(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this somewhat complicated handler and replaced with simply the LoadingPlaceholder, which is how it's done elsewhere in the code. The error handling was not relevant to the ways it could actually fail.

return <RouteAsPortalOrNot />;
}

export function isNoDataPage(dir: string) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling these in both portal and non-portal routes was the main issue I had to fix.


if (isFlex) {
return <FlexPage data={data} />;
if (data?.body) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making this all follow the same short-circuit pattern.

} from '~/components/book-selector/book-selector';
import {useAfterSubmit} from '~/components/book-selector/after-form-submit';
import {MemoryRouter} from 'react-router-dom';
import MemoryRouter from '~/../../test/helpers/future-memory-router';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finally went through and replaced all of these. There are a bunch. The standard memory router gives a warning, making a lot of tests noisy.

await screen.findByText('What is your question about?');
expect(screen.queryAllByRole('navigation')).toHaveLength(0);
});
it('handles piTracker ', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tested in use-link-handler, and the test here is flaky.


return <div>-{loc.pathname}-</div>;
}
function mockBrowserInitialEntriesWithLocation(entries: string[]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed a bunch of repetitive calls in tests.

@RoyEJohnson RoyEJohnson requested a review from jivey October 6, 2025 22:03
@RoyEJohnson RoyEJohnson merged commit 5155545 into main Oct 8, 2025
1 check passed
@RoyEJohnson RoyEJohnson deleted the core-1268-review-portal-routing-and-tests branch October 8, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants