-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from jvmistica/test/improve-test-coverage
test: improve test coverage
- Loading branch information
Showing
6 changed files
with
698 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"flag" | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/jvmistica/gcal/pkg/gcal" | ||
|
@@ -11,6 +14,11 @@ import ( | |
var ( | ||
defaultCalendarID = "en.austrian#[email protected]" | ||
key = os.Getenv("GCP_API_KEY") | ||
suggestion = "Leave Suggestions" | ||
q1 = "Jan - Mar" | ||
q2 = "Apr - Jun" | ||
q3 = "Jul - Sep" | ||
q4 = "Oct - Dec" | ||
) | ||
|
||
// go run main.go -start=2023-05-01T00:00:00Z -end=2023-05-31T00:00:00Z | ||
|
@@ -21,7 +29,25 @@ func main() { | |
end := flag.String("end", "", "the end date") | ||
flag.Parse() | ||
|
||
gcal.Query(key, start, end, calendarID) | ||
events, suggestions, err := gcal.GetCalendarEvents(key, *start, *end, *calendarID) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
e, err := json.MarshalIndent(events, "", " ") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
fmt.Println("No leaves") | ||
fmt.Println(string(e)) | ||
|
||
s, err := json.MarshalIndent(suggestions, "", " ") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
fmt.Println("Suggestions") | ||
fmt.Println(string(s)) | ||
|
||
// boardID, err := trello.CreateBoard("Holidays") | ||
// if err != nil { | ||
|
@@ -39,18 +65,21 @@ func main() { | |
// log.Fatal(err) | ||
// } | ||
|
||
// q2ListID, err := trello.CreateList(boardID, q2, "3") | ||
// if err != nil { | ||
// log.Fatal(err) | ||
// } | ||
// // q2ListID, err := trello.CreateList(boardID, q2, "3") | ||
// // if err != nil { | ||
// // log.Fatal(err) | ||
// // } | ||
|
||
// q3ListID, err := trello.CreateList(boardID, q3, "4") | ||
// if err != nil { | ||
// log.Fatal(err) | ||
// } | ||
// // q3ListID, err := trello.CreateList(boardID, q3, "4") | ||
// // if err != nil { | ||
// // log.Fatal(err) | ||
// // } | ||
|
||
// q4ListID, err := trello.CreateList(boardID, q4, "5") | ||
// if err != nil { | ||
// log.Fatal(err) | ||
// } | ||
// // q4ListID, err := trello.CreateList(boardID, q4, "5") | ||
// // if err != nil { | ||
// // log.Fatal(err) | ||
// // } | ||
|
||
// _, _ = trello.CreateCard(q1ListID, string(e)) | ||
// _, _ = trello.CreateCard(suggestListID, string(s)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.