Closed Alesha72003 closed 3 years ago
I tried making tests but not sure if they are simple. 1) There is no observer movement (since it is on the Earth's axis of rotation), the satellite's velocity vector is perpendicular to the observer-satellite vector, therefore, in this test, the Doppler effect should not affect the frequency. This test verifies the basic principle of the Doppler effect 2) There is movement of the observer, but the observer's velocity vector is perpendicular to the observer-satellite vector, so this movement does not affect the Doppler effect. This test verifies the correctness of accounting for the observer's movement. 3) A special case. This test verifies the correctness of the calculation taking into account the speeds of the satellite and the observer.
@Alesha72003 I think that your tests are more than fine. First of all, I meant that we need to improve test coverage and having some tests for dopplerFactor
is much better than nothing. If something is broken it will be easier to fix it. Any additional tests can be provided later if required.
The last thing I want to be fixed is to use toBeCloseTo
instead of toEqual
. After that I can merge this PR and publish the changes to npm.
what value of numDigits
to use in tests?
Let's take 8 digits, I think it will be enough.
All right?
@Alesha72003 Great! Just published 4.1.3. Give it a try!
This is my first pull request. I may be doing something wrong English is not my native language This commit fixes the computation of the Doppler effect.
DopplerFactor
now takes into account the observer's movement.Before changes:
After changes:
Code used: