github.com/Financial-Times/publish-availability-monitor@v1.12.0/checks/preCheck_test.go (about) 1 package checks 2 3 import ( 4 "testing" 5 "time" 6 ) 7 8 const threshold = 120 9 10 func TestIsMessagePastPublishSLA_pastSLA(t *testing.T) { 11 publishDate := time.Now().Add(-(threshold + 1) * time.Second) 12 if !isMessagePastPublishSLA(publishDate, threshold) { 13 t.Error("Did not detect message past SLA") 14 } 15 } 16 17 func TestIsMessagePastPublishSLA_notPastSLA(t *testing.T) { 18 publishDate := time.Now() 19 if isMessagePastPublishSLA(publishDate, threshold) { 20 t.Error("Valid message marked as passed SLA") 21 } 22 }