|
6 | 6 | "net/http" |
7 | 7 | "testing" |
8 | 8 |
|
9 | | - "github.com/OneBusAway/go-gtfs" |
10 | 9 | "github.com/stretchr/testify/assert" |
11 | 10 | "github.com/stretchr/testify/require" |
12 | 11 | "maglev.onebusaway.org/gtfsdb" |
@@ -51,6 +50,7 @@ func TestStopHandlerEndToEnd(t *testing.T) { |
51 | 50 | require.Len(t, model.Data.References.Routes, len(testdata.Stop4062.RouteIDs), |
52 | 51 | "references.routes count should match entry.routeIds count") |
53 | 52 | assert.Equal(t, []models.AgencyReference{testdata.Raba}, model.Data.References.Agencies) |
| 53 | + assert.Empty(t, model.Data.References.Situations, "situations should always be empty for this endpoint") |
54 | 54 | } |
55 | 55 |
|
56 | 56 | func TestStopHandler_NotFoundAndMalformed(t *testing.T) { |
@@ -178,33 +178,6 @@ func TestStopHandlerMultiAgencyScenario(t *testing.T) { |
178 | 178 | assert.True(t, agencyIDs[agencyB], "AgencyB should be in references") |
179 | 179 | } |
180 | 180 |
|
181 | | -// TestStopHandlerWithSituations verifies that an alert informing the same |
182 | | -// situation against multiple entities (stop + route) deduplicates to one |
183 | | -// situation in references. |
184 | | -func TestStopHandlerWithSituations(t *testing.T) { |
185 | | - api := createTestApi(t) |
186 | | - defer api.Shutdown() |
187 | | - |
188 | | - // Real-time alerts use raw (un-prefixed) ids from the GTFS-RT feed. |
189 | | - rawStopID := "4062" // Stop4062 = "25_4062" |
190 | | - rawRouteID := "154" // Stop4062 is on route 25_154 |
191 | | - const alertID = "test-cross-entity-alert-789" |
192 | | - api.GtfsManager.AddAlertForTest(gtfs.Alert{ |
193 | | - ID: alertID, |
194 | | - InformedEntities: []gtfs.AlertInformedEntity{ |
195 | | - {StopID: &rawStopID}, |
196 | | - {RouteID: &rawRouteID}, |
197 | | - }, |
198 | | - }) |
199 | | - |
200 | | - resp, model := callAPIHandler[StopEntryResponse](t, api, stopURL(testdata.Stop4062.ID)) |
201 | | - |
202 | | - assert.Equal(t, http.StatusOK, resp.StatusCode) |
203 | | - require.Len(t, model.Data.References.Situations, 1, |
204 | | - "expected exactly one deduplicated situation despite matching multiple entities") |
205 | | - assert.Equal(t, alertID, model.Data.References.Situations[0].ID) |
206 | | -} |
207 | | - |
208 | 181 | // TestStopHandler_StopCodeFallback verifies that when a stop has no stop_code |
209 | 182 | // in the database (Code is a null NullString), the response falls back to |
210 | 183 | // returning the raw entity portion of the combined ID as the code field. |
|
0 commit comments