Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scc 3773/utils testing #31

Merged
merged 29 commits into from
Oct 11, 2023
Merged

Scc 3773/utils testing #31

merged 29 commits into from
Oct 11, 2023

Conversation

charmingduchess
Copy link
Contributor

@charmingduchess charmingduchess commented Oct 2, 2023

  • Added tests for appUtils,bibUtils, drbUtils, searchUtils.
  • created test helper that checks query strings for matching key=value pairs. This is so we are not stuck on order if the order changes with the new query param parsing library.
  • Not 100% sure if it's necessary, but i added some logic into getSearchQuery to exclude the sort_direction parameter if none is supplied.
  • moved all tests to be in same directory as the file they're testing

@vercel
Copy link

vercel bot commented Oct 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
research-catalog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 11, 2023 2:17pm

@charmingduchess charmingduchess changed the base branch from main to SCC-3601/advanced-search-utils October 2, 2023 20:03
@charmingduchess charmingduchess changed the base branch from SCC-3601/advanced-search-utils to main October 3, 2023 18:56
Copy link
Member

@EdwinGuzman EdwinGuzman left a comment

Choose a reason for hiding this comment

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

One minor naming comment. Otherwise, I'd prefer if the jest.config file can be updated to exclude specific files rather than nest __test__ in test. If it doesn't work then we can keep the nested directory but it makes it unclear why we need the nesting unless if you're writing tests.

src/utils/searchUtils.ts Show resolved Hide resolved
test/__test__/utils/drbUtils.test.tsx Outdated Show resolved Hide resolved
)
})

it("should combine query params", () => {
Copy link
Member

Choose a reason for hiding this comment

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

The more I look at this file the more complex the query object vs the url query is. All seems fine but just pointing out the complexity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how so?

@dgcohen
Copy link
Contributor

dgcohen commented Oct 6, 2023

Looks good! After our conversation, I think it makes sense to try to extend the jest configuration to allow for tests to be picked up in the pages directory. Could you look into that as part of this work?

Also, it just occurred to be that since jest picks up any tests with the test.tsx extension, we could probably co-locate the tests in the same directory as the component rather than putting it in a __test__ dir.

E.g.
Screenshot 2023-10-06 at 2 46 45 PM

What do you and @EdwinGuzman think?

@EdwinGuzman
Copy link
Member

The other test PR resolves the comment above ✅

@charmingduchess charmingduchess merged commit c9cc876 into main Oct 11, 2023
2 checks passed
@dgcohen dgcohen deleted the SCC-3773/utils-testing branch February 1, 2024 16:18
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