From 83b5aef3e359e3441520bdd9742d3345b03b75e3 Mon Sep 17 00:00:00 2001 From: "Michael J. Roberts" Date: Thu, 2 Mar 2023 16:47:22 +0000 Subject: [PATCH] feat: Added GetTwilight(c *gin.Context) version 2.0.0. feat: Added GetTwilight(c *gin.Context) version 2.0.0. Includes updated associated test suite for module export definition and expected output. --- main.go | 5 ++++- pkg/twilight/twilight_test.go | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 0c2431d..15f90ab 100644 --- a/main.go +++ b/main.go @@ -40,12 +40,15 @@ func main() { // Transit Properties API r.GET("/api/v1/transit", transit.GetTransitDeprecatedV1) - // Transit Properties API version 2 (^14.02.2023): + // Transit Properties API version 2 (^02.03.2023): r.GET("/api/v2/transit", transit.GetTransit) // Twilight (Crepusculum) Properties API r.GET("/api/v1/twilight", twilight.GetTwilight) + // Twilight (Crepusculum) Properties API version 2 (^02.03.2023): + r.GET("/api/v2/twilight", twilight.GetTwilight) + // Listen on port log.Fatal(r.Run(*port)) } diff --git a/pkg/twilight/twilight_test.go b/pkg/twilight/twilight_test.go index a0082b5..0b1408f 100644 --- a/pkg/twilight/twilight_test.go +++ b/pkg/twilight/twilight_test.go @@ -21,7 +21,7 @@ func SetupTwilightRouter() *gin.Engine { // Create gin router r := gin.Default() - r.GET("/api/v1/twilight", GetTwilight) + r.GET("/api/v2/twilight", GetTwilight) return r } @@ -40,7 +40,7 @@ func performRequest(r http.Handler, method, path string) *httptest.ResponseRecor } // Perform a GET request with that handler. -var w = performRequest(r, "GET", "/api/v1/twilight?datetime=2021-05-14T00:00:00.000Z&longitude=-155.468094&latitude=19.798484") +var w = performRequest(r, "GET", "/api/v2/twilight?datetime=2021-05-14T00:00:00.000Z&longitude=-155.468094&latitude=19.798484") func TestTwilightRouteStatusCode(t *testing.T) { // Assert we encoded correctly, the request gives a 200: