package queries_test

import (
	"testing"

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

func TestDTCIntegration(t *testing.T) {
	t.Skip()
	query := setupECUDTC(t)

	testDTCInsert(t, query)
}

func setupECUDTC(t *testing.T) queries.ECU {
	instance := queries.ECU{}
	conn = instance.GetDBConn()
	conn.AddQueryHook(db.SQLLogger{})

	return instance
}

func testDTCInsert(t *testing.T, query queries.ECU) {

	var EcuDtc = []m.DTC_ECU{
		{
			VIN:         "1B7HF16Y8TS510206",
			ECU:         "AMP",
			TroubleCode: 123,
		},
		{
			VIN:         "1B7HF16Y8TS510206",
			ECU:         "Brake",
			TroubleCode: 456,
		},
	}
	_, err := query.Insert(&EcuDtc)
	if err != nil {
		t.Errorf(testhelper.TestErrorTemplate, "Failed to insert DTCs", "No error", err)
	}

}
