test: simplify canonized-prochirality cache transfer test - #240
Conversation
Assert the transferred cache entry directly (reference equality on `prochiralityByEnantioID`) instead of monkey-patching OCL's `ensureHelperArrays` to count CIP recomputations. The shared reference is the optimisation, so this tests intent directly and drops the spy, the try/finally restore, and coupling to OCL internals.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #240 +/- ##
=======================================
Coverage 90.92% 90.92%
=======================================
Files 94 94
Lines 2743 2743
Branches 704 704
=======================================
Hits 2494 2494
Misses 226 226
Partials 23 23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@targos Is the the correct way ? it is not clear to me if we need to mockRestore: https://vitest.dev/api/mock.html |
|
I don't understand. The description says that spying is no longer necessary, but it's still there.
|
|
Note that there is another test with manual |
|
Yes I first removed the spying but then thought that it is an interesting way to spy the ensureHelper and that actually it is complementary. So I added it again (this is why there are 2 commits) |
Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Simplifies the
canonizedProchiralities is transferred across TopicMolecule instancestest.It previously monkey-patched OpenChemLib's
ensureHelperArraysto count CIP recomputations as an indirect proxy for "the cache was reused". SincefromMoleculetransfers the cache entry by reference, the test now asserts that reference equality directly (reused.cache.prochiralityByEnantioIDis the same object as the original) plus that the resulting labels are still correct. No spy, no try/finally restore, no coupling to OCL internals.