You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import { describe , expect , it } from "vitest" ;
import { cmToIn , kgToLb , toAxelWholeInches , toAxelWholePounds } from "@/modules/quote/unit-converter" ;
describe ( "unit-converter" , ( ) = > {
it ( "227kg → 500.45lb( ROUND_HALF_UP, JS 浮点 227× 2.20462) " , ( ) = > {
expect ( kgToLb ( 227 ) ) . toBe ( 500.45 ) ;
} ) ;
it ( "122cm → 48.03in" , ( ) = > {
expect ( cmToIn ( 122 ) ) . toBe ( 48.03 ) ;
} ) ;
it ( "120cm 转 axel 尺寸向上取整为 48in" , ( ) = > {
expect ( toAxelWholeInches ( cmToIn ( 120 ) ) ) . toBe ( 48 ) ;
} ) ;
it ( "500kg 转 axel 重量向上取整为 1103lb" , ( ) = > {
expect ( toAxelWholePounds ( kgToLb ( 500 ) ) ) . toBe ( 1103 ) ;
} ) ;
it ( "500lb 不变" , ( ) = > {
expect ( kgToLb ( 500 / 2.20462 ) ) . toBeCloseTo ( 500 , 0 ) ;
} ) ;
} ) ;