Skip to content

Commit

Permalink
Merge pull request #420 from opentripplanner/dev
Browse files Browse the repository at this point in the history
Patch release July 22 2021
  • Loading branch information
landonreed authored Jul 22, 2021
2 parents 3f5a2a5 + 518def8 commit 4cf9c0e
Show file tree
Hide file tree
Showing 109 changed files with 1,810 additions and 1,067 deletions.
62 changes: 61 additions & 1 deletion __tests__/actions/__snapshots__/api.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,37 @@ Array [
"pending": 1,
"routingType": "ITINERARY",
"searchId": "abcd1234",
"updateSearchInReducer": false,
},
"type": "ROUTING_REQUEST",
},
],
Array [
[Function],
],
Array [
Object {
"payload": Object {
"requestId": "abcd1238",
"response": Object {
"fake": "response",
},
"searchId": "abcd1234",
},
"type": "ROUTING_RESPONSE",
},
],
Array [
Object {
"payload": Object {
"error": [TypeError: Cannot read property 'trackRecent' of undefined],
"requestId": "abcd1239",
"searchId": "abcd1234",
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false",
},
"type": "ROUTING_ERROR",
},
],
Array [
[Function],
],
Expand All @@ -28,14 +52,26 @@ Array [
"activeItinerary": 0,
"pending": 1,
"routingType": "ITINERARY",
"searchId": "abcd1235",
"searchId": "abcd1237",
"updateSearchInReducer": false,
},
"type": "ROUTING_REQUEST",
},
],
Array [
[Function],
],
Array [
Object {
"payload": Object {
"error": [Error: Received error from server],
"requestId": "abcd1240",
"searchId": "abcd1237",
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false",
},
"type": "ROUTING_ERROR",
},
],
]
`;

Expand All @@ -51,13 +87,37 @@ Array [
"pending": 1,
"routingType": "ITINERARY",
"searchId": "abcd1234",
"updateSearchInReducer": false,
},
"type": "ROUTING_REQUEST",
},
],
Array [
[Function],
],
Array [
Object {
"payload": Object {
"requestId": "abcd1235",
"response": Object {
"fake": "response",
},
"searchId": "abcd1234",
},
"type": "ROUTING_RESPONSE",
},
],
Array [
Object {
"payload": Object {
"error": [TypeError: Cannot read property 'trackRecent' of undefined],
"requestId": "abcd1236",
"searchId": "abcd1234",
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false",
},
"type": "ROUTING_ERROR",
},
],
]
`;

Expand Down
16 changes: 16 additions & 0 deletions __tests__/actions/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ describe('actions > api', () => {
})

await routingQueryAction(mockDispatch, mockGetState)

setMockRequestIds(mockDispatch.mock.calls)
expect(mockDispatch.mock.calls).toMatchSnapshot()
})

Expand All @@ -57,7 +59,21 @@ describe('actions > api', () => {
})
await routingQueryAction(mockDispatch, mockGetState)

setMockRequestIds(mockDispatch.mock.calls)
expect(mockDispatch.mock.calls).toMatchSnapshot()
})
})
})

/**
* Sets the requestId values as needed to deterministic IDs.
*/
function setMockRequestIds (calls) {
calls.forEach(call => {
call.forEach(action => {
if (action.payload && action.payload.requestId) {
action.payload.requestId = randId()
}
})
})
}
4 changes: 2 additions & 2 deletions __tests__/util/itinerary.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe('util > itinerary', () => {
rentedVehicle: true
}
const rideHailLeg = {
mode: 'CAR_HAIL',
hailedCar: true
hailedCar: true,
mode: 'CAR_HAIL'
}

const testCases = [{
Expand Down
18 changes: 18 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@ modes:
# - id: call
# # Provides UI elements for planning field trips on transit vehicles.
# - id: ft
# # An optional maximum number of requests to make to OTP when trying to
# # find itineraries. Defaults to 10 if not provided.
# maxRequests: 10
# # An optional minimum remaining capacity that a tripId must retain in the
# # event that multiple field trips use the same trip. Defaults to 10 if not
# # provided.
# minimumAllowableRemainingCapacity: 10
# # An optional lookup of the field trip capacity for each mode. Defaults
# # are shown below if any one of these are not provided.
# modeCapacities:
# TRAM: 80
# SUBWAY: 120
# RAIL: 80
# BUS: 40
# FERRY: 100
# CABLE_CAR: 20
# GONDOLA: 15
# FUNICULAR: 20
# # Provides a form for constructing PDF documents for mailing to customers.
# - id: mailables
# items:
Expand Down
Loading

0 comments on commit 4cf9c0e

Please sign in to comment.