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

Added DataLoader source generator snapshot tests #7290

Merged
merged 5 commits into from
Jul 24, 2024

Conversation

glen-84
Copy link
Collaborator

@glen-84 glen-84 commented Jul 23, 2024

Summary of the changes (Less than 80 chars)

  • Added DataLoader source generator snapshot tests.

ℹ️ Notes:

  1. I added the package Basic.Reference.Assemblies, as an alternative to loading all assemblies in the AppDomain (like this). I'm not sure which is the better option.
  2. I've just added a few tests to demonstrate the snapshotting. Feel free to add more.
  3. The snapshots don't look great, because I need to be able to specify the Markdown language per segment (to be discussed tomorrow).

❓ Questions:

  1. ✅ All 3 snapshots show a CacheDataLoader being generated – am I doing something wrong? Is the DataLoader type not based on the method signature?
  2. ✅ The cancellation token is accessed via _services.GetRequiredService – should it be using the ct parameter of LoadSingleAsync instead?
  3. ✅ The generated class name in HotChocolateMiddleware.735550c.g.cs has a variable GUID suffix – is that important? For now, I've added code to replace it with HASH in the snapshots.
  4. ✅ I've put the tests in the HotChocolate.Types.Analyzers.Tests project – can the HotChocolate.Types.Analyzers.DataLoader.Tests project be deleted?

@glen-84 glen-84 added the 👓 ready-for-review The PR is ready for review. label Jul 23, 2024
Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.81%. Comparing base (b91ddb7) to head (620ba7c).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7290      +/-   ##
==========================================
- Coverage   78.84%   75.81%   -3.04%     
==========================================
  Files        2421     2785     +364     
  Lines      118431   138544   +20113     
==========================================
+ Hits        93379   105035   +11656     
- Misses      25052    33509    +8457     
Flag Coverage Δ
unittests 75.81% <ø> (-3.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@glen-84 glen-84 marked this pull request as ready for review July 24, 2024 11:09
@michaelstaib michaelstaib merged commit 33900c7 into main Jul 24, 2024
5 checks passed
@michaelstaib michaelstaib deleted the gai/dataloader-tests branch July 24, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants