package cache_test

import (
	"testing"

	m "github.com/fiskerinc/cloud-services/pkg/common"
	"github.com/fiskerinc/cloud-services/pkg/cache"

	"github.com/stretchr/testify/assert"
)

var (
	dtc = m.DTC_ECU{
		VIN: "3FAFP13P71R199432",
		ECU: "ACU",
		TroubleCode: 8388881,
	}
)

func TestSetAndExists(t *testing.T) {
	carDtcCache := cache.NewCarDTCsCache(1000)
	exists := carDtcCache.Exists(dtc)

	assert.Equal(t, exists, false)

    carDtcCache.Set(dtc)

	exists = carDtcCache.Exists(dtc)

	assert.Equal(t, exists, true)
}