package common_test

import (
	"testing"
	"time"

	"github.com/fiskerinc/cloud-services/pkg/common"
	"github.com/fiskerinc/cloud-services/pkg/common/dbbasemodel"
	"github.com/fiskerinc/cloud-services/pkg/testhelper"
)

func TestSupplierAccount(t *testing.T) {
	now := time.Now()
	expected := "SupplierAccount<Test Company, 555 Main, San Francisco, CA 94103, Test Contact, +1 555-555-5555, test@test.com, Test Program, <nil>, <nil>, <nil>, <nil>, <nil>>"
	supplier := common.SupplierAccount{
		Email:       " TEST@TEST.COM ",
		Company:     " Test Company ",
		Contact:     " Test Contact ",
		Address:     " 555 Main, San Francisco, CA 94103 ",
		Telephone:   " +1 555-555-5555 ",
		Program:     " Test Program ",
		ECUs:        []string{"", " TEST ", "TEST1 "},
		ActivatedAt: &now,
		KeysAt:      &now,
		SigninAt:    &now,
		DBModelBase: dbbasemodel.DBModelBase{
			CreatedAt: &now,
			UpdatedAt: &now,
		},
	}

	supplier.SanitizeData()

	actual := supplier.String()
	if actual != expected {
		t.Errorf(testhelper.TestErrorTemplate, "SupplierAccount", expected, actual)
	}
}
