You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a test to verify it converts back and forth to the best fitting unit (essentially an identity conversion):
it('checks out',()=>{expect(convert(convert(1,'sq mi').to('m2'),'m2').to('sq mi')).toBe(1);// ✔️ explicit conversion works as expectedexpect(convert(convert(1,'sq mi').to('m2'),'m2').to('best','imperial')).toMatchObject({quantity: 1,unit: 'sq mi',});// ❌ implicit conversion doesn't work, see screenshot});
Result:
I expect it to convert to the next highest unit when its value is >= 1 but it stays at acres (indefinitely). Even when going up to 10 or 100 square miles it is not working, see:
I think the same problem applies between square feet <-> acres. If you're interested I can produce a test for that as well.
For metric system everything works as expected.
The text was updated successfully, but these errors were encountered:
This issue doesn't have to do with converting back and forth. It's just that the array of imperial units to use for area lists acres as being larger than square miles, hence 640 ac being returned instead of 1 sq mi.
I wrote a test to verify it converts back and forth to the best fitting unit (essentially an identity conversion):
Result:
I expect it to convert to the next highest unit when its value is
>= 1
but it stays at acres (indefinitely). Even when going up to 10 or 100 square miles it is not working, see:I think the same problem applies between square feet <-> acres. If you're interested I can produce a test for that as well.
For metric system everything works as expected.
The text was updated successfully, but these errors were encountered: