Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

880 B
Raw Blame
package api

import "testing"

func TestIsAIInvestigationEnabled_DefaultFalse(t *testing.T) {
	SetAIInvestigationEnabled(nil)
	t.Cleanup(func() { SetAIInvestigationEnabled(nil) })

	if isAIInvestigationEnabled() {
		t.Fatal("expected false when no hook is registered")
	}
}

func TestIsAIInvestigationEnabled_TrueWhenSet(t *testing.T) {
	SetAIInvestigationEnabled(nil)
	t.Cleanup(func() { SetAIInvestigationEnabled(nil) })

	SetAIInvestigationEnabled(func() bool { return true })
	if !isAIInvestigationEnabled() {
		t.Fatal("expected true when hook returns true")
	}
}

func TestIsAIInvestigationEnabled_FalseWhenHookReturnsFalse(t *testing.T) {
	SetAIInvestigationEnabled(nil)
	t.Cleanup(func() { SetAIInvestigationEnabled(nil) })

	SetAIInvestigationEnabled(func() bool { return false })
	if isAIInvestigationEnabled() {
		t.Fatal("expected false when hook returns false")
	}
}