phetsims / faradays-electromagnetic-lab

"Faraday's Electromagnetic Lab" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 0 forks source link

Consider unit tests #131

Closed samreid closed 8 months ago

samreid commented 8 months ago

During the code review #103, we observed code that would benefit from unit testing. For example:

Unit tests would be helpful because they would (a) allow us to check the behavior against the ground truth for known situations and (b) prevent accidental breakage in the future.

This is not a comprehensive list of all places where unit testing may prove valuable in Faraday's Electromagnetic Lab, just some occurrences that we observed.

samreid commented 8 months ago

In #122 the code review recommended using common code for the quadratic bezier implementation. If common code is not used there, then QuadraticBezierSpline.ts could be another good opportunity for unit tests.

pixelzoom commented 8 months ago

I'm skeptical about the bits that you identified in https://github.com/phetsims/faradays-electromagnetic-lab/issues/131#issue-2209450215. I will note that those 2 methods are @private, have survived 19 years without unit tests, and would require a considerable test harness.

More generally, PhET has close to zero unit tests for sims, and I don't relish being the guniea pig.

So I don't really feel like there's enough here to make a "unit tests" effort worth the hassle and expense.