mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Fix bug
I missed a bit in a refactor, and it wasn't covered by the spec.
This commit is contained in:
@@ -21,7 +21,8 @@ export default class VariantUnitManager {
|
||||
.filter(([scale, scaleInfo]) => {
|
||||
return scaleInfo['system'] == scaleSystem;
|
||||
})
|
||||
.map(([scale, _]) => parseFloat(scale));
|
||||
.map(([scale, _]) => parseFloat(scale))
|
||||
.sort();
|
||||
}
|
||||
|
||||
// private
|
||||
|
||||
@@ -40,6 +40,7 @@ describe("VariantUnitManager", function() {
|
||||
it("returns a sorted set of compatible scales based on the scale and unit type provided", function() {
|
||||
expect(subject.compatibleUnitScales(1, "weight")).toEqual([1.0, 1000.0, 1000000.0]);
|
||||
expect(subject.compatibleUnitScales(453.6, "weight")).toEqual([28.35, 453.6]);
|
||||
expect(subject.compatibleUnitScales(0.001, "volume")).toEqual([0.001, 1.0, 1000.0]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user