From 7ae1c766447711ee568566ba52a23f99cc92a49f Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Fri, 10 Sep 2021 17:31:59 +0200 Subject: Refactoring of navitia mocking code for the webui --- internal/webui/root_test.go | 14 -------------- internal/webui/utils_test.go | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'internal/webui') diff --git a/internal/webui/root_test.go b/internal/webui/root_test.go index b86bb1c..7e4ec71 100644 --- a/internal/webui/root_test.go +++ b/internal/webui/root_test.go @@ -10,20 +10,6 @@ import ( "github.com/stretchr/testify/require" ) -type NavitiaMockClient struct { - departures []model.Departure - trainStops []model.Stop - err error -} - -func (c *NavitiaMockClient) GetDepartures(trainStop string) (departures []model.Departure, err error) { - return c.departures, c.err -} - -func (c *NavitiaMockClient) GetStops() (trainStops []model.Stop, err error) { - return c.trainStops, c.err -} - func TestRootHandler(t *testing.T) { // test environment setup dbEnv, err := database.InitDB("sqlite3", "file::memory:?_foreign_keys=on") diff --git a/internal/webui/utils_test.go b/internal/webui/utils_test.go index 1e07aa2..bd24dd5 100644 --- a/internal/webui/utils_test.go +++ b/internal/webui/utils_test.go @@ -9,10 +9,25 @@ import ( "strings" "testing" + "git.adyxax.org/adyxax/trains/pkg/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) +type NavitiaMockClient struct { + departures []model.Departure + stops []model.Stop + err error +} + +func (c *NavitiaMockClient) GetDepartures(stop string) (departures []model.Departure, err error) { + return c.departures, c.err +} + +func (c *NavitiaMockClient) GetStops() (stops []model.Stop, err error) { + return c.stops, c.err +} + var simpleErrorMessage = fmt.Errorf("") type httpTestCase struct { -- cgit v1.2.3