package helpers

import "testing"

func TestNormalize(t *testing.T) {
	type scenario struct {
		name   string
		value  string
		result float64
		err    error
	}
	cases := []scenario{
		{
			name:   "sucess/parse/dolar",
			value:  "$58.40",
			result: 58.40,
			err:    nil,
		},
		{
			name:   "sucess/parse/dolar",
			value:  "dollar $58.40",
			result: 58.40,
			err:    nil,
		},
		{
			name:   "sucess/parse/dolar",
			value:  "$",
			result: 0,
			err:    nil,
		},
	}
	for idx, tt := range cases {
		t.Run(tt.name, func(t *testing.T) {
			r := Normalize(tt.value)
			if r != tt.result {
				t.Errorf("case #%d - wanted: %f - got: %f", idx, tt.result, r)
			}
		})
	}
}
