logs-analyzer/signoz/pkg/query-service/formatter/scale_test.go

16 lines
324 B
Go
Raw Normal View History

2024-09-02 22:47:30 +03:00
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))
}