16 lines
324 B
Go
16 lines
324 B
Go
package formatter
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestToFixed(t *testing.T) {
|
|
twoDecimals := 2
|
|
require.Equal(t, "0", toFixed(0, nil))
|
|
require.Equal(t, "61", toFixed(60.99, nil))
|
|
require.Equal(t, "51.4", toFixed(51.42, nil))
|
|
require.Equal(t, "51.42", toFixed(51.42, &twoDecimals))
|
|
}
|