mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-19 10:33:29 +00:00
32 lines
880 B
Go
32 lines
880 B
Go
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")
|
|
}
|
|
}
|