package handlers_test

import (
	"encoding/json"
	"testing"

	"github.com/fiskerinc/cloud-services/services/depot/handlers"

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

func TestHMIInit(t *testing.T) {
	setupRedisMock()
	setupDBMock()

	id := "FISKER123"
	sessionData := common.HMISessionData{
		SessionID: "XXXXX",
	}
	data, err := json.Marshal(sessionData)
	if err != nil {
		t.Errorf(testhelper.TestErrorTemplate, "TestHMIInit", nil, err)
	}

	err = handlers.HMIInit(mockDB, id, data)
	if err != nil {
		t.Errorf(testhelper.TestErrorTemplate, "TestHMIInit", nil, err)
	}
}
