package health

import (
	"testing"

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

func TestWithChecks(t *testing.T) {
	h1, err := New()
	testhelper.NoError(t, "New", err)
	testhelper.Len(t, "New", h1.checks, 0)

	h2, err := New(WithChecks(Config{
		Name: "foo",
	}, Config{
		Name: "bar",
	}))
	testhelper.NoError(t, "New WithChecks", err)
	testhelper.Len(t, "New WithChecks", h2.checks, 2)

	_, err = New(WithChecks(Config{
		Name: "foo",
	}, Config{
		Name: "foo",
	}))
	testhelper.Error(t, "New WithChecks", err)
}
