package querystring_test

import (
	"testing"

	"github.com/fiskerinc/cloud-services/pkg/utils/querystring"
	"github.com/stretchr/testify/assert"
)

func TestConvertStringToInt(t *testing.T) {
	input := "3.14"
	result, err := querystring.ConvertStringToInt(input)
	assert.Nil(t, err)
	assert.Equal(t, result, 3)

	input = "447"
	result, err = querystring.ConvertStringToInt(input)
	assert.Nil(t, err)
	assert.Equal(t, result, 447)

	input = "abc"
	result, err = querystring.ConvertStringToInt(input)
	assert.NotNil(t, err)
	assert.Equal(t, result, 0)
}
