package alerts

import "testing"

func TestNotifyKEVFromSysCheckNoPanic(t *testing.T) {
	n := NewNotifier(func() Settings {
		return NewSettings(NotifyConfig{}, EventToggles{KEVExposure: true})
	})
	msg := `{"kev_exposure":{"exposed_count":1,"critical_count":1,"summary":"test","findings":[{"cve":"CVE-2021-26855","name":"ProxyLogon","status":"exposed","severity":"critical"}]}}`
	NotifyKEVFromSysCheck(n, "worker-1", msg)
}

func TestNotifyKEVSkipsWhenClear(t *testing.T) {
	n := NewNotifier(func() Settings {
		return NewSettings(NotifyConfig{TelegramBotToken: "x", TelegramChatID: "1"}, EventToggles{KEVExposure: true})
	})
	NotifyKEVFromSysCheck(n, "w", `{"kev_exposure":{"exposed_count":0,"critical_count":0}}`)
}
