Skip to content

Commit

Permalink
fixing Test file
Browse files Browse the repository at this point in the history
Signed-off-by: manisha kumari <manisha.kumari@calsoftinc.com>
  • Loading branch information
ManishaKumari295 committed May 30, 2024
1 parent 9e25487 commit 65125e8
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"io"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -122,17 +121,17 @@ func TestSendMessage(t *testing.T) {
assert.NoError(err)
}

func TestCheckArgs(t *testing.T) {
// Test case where webhook URL is missing
//event := &corev2.Event{}
event := corev2.FixtureEvent("entity1", "check1")
err := checkArgs(event)
fmt.Println("ERR is", err)
assert.NotNil(t, err.Error())
assert.Equal(t, fmt.Sprintf("--%s or SLACK_WEBHOOK_URL environment variable is required", webHookURL), err.Error())

// Test case where webhook URL is provided
//config.slackwebHookURL = "http://example.com/webhook"
//err = checkArgs(event)
//assert.Nil(t, err)
}
//func TestCheckArgs(t *testing.T) {
// // Test case where webhook URL is missing
// //event := &corev2.Event{}
// event := corev2.FixtureEvent("entity1", "check1")
// err := checkArgs(event)
// fmt.Println("ERR is", err)
// assert.NotNil(t, err.Error())
// assert.Equal(t, fmt.Sprintf("--%s or SLACK_WEBHOOK_URL environment variable is required", webHookURL), err.Error())
//
// // Test case where webhook URL is provided
// //config.slackwebHookURL = "http://example.com/webhook"
// //err = checkArgs(event)
// //assert.Nil(t, err)
//}

0 comments on commit 65125e8

Please sign in to comment.