Skip to content

Commit

Permalink
Merge pull request #126 from opentripplanner/dev
Browse files Browse the repository at this point in the history
Next Release
  • Loading branch information
landonreed authored Feb 14, 2020
2 parents 30b71a3 + 3b7694a commit a16abb4
Show file tree
Hide file tree
Showing 12 changed files with 1,042 additions and 289 deletions.
91 changes: 91 additions & 0 deletions __tests__/util/__mocks__/itinerary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"route1": {
"longName": "Across town",
"mode": "BUS",
"shortName": "10",
"sortOrder": 10
},
"route2": {
"longName": "Around town",
"mode": "BUS",
"shortName": "20",
"sortOrder": 2
},
"route3": {
"longName": "Around another town",
"mode": "BUS",
"shortName": "3",
"sortOrder": -999
},
"route4": {
"longName": "Loop route",
"mode": "BUS",
"shortName": "2",
"sortOrder": -999
},
"route5": {
"longName": "A-line",
"mode": "BUS",
"shortName": "A",
"sortOrder": -999
},
"route6": {
"longName": "B-line",
"mode": "BUS",
"shortName": "B",
"sortOrder": -999
},
"route7": {
"longName": "A meandering route",
"mode": "BUS",
"sortOrder": -999
},
"route8": {
"longName": "Zig-zagging route",
"mode": "BUS",
"shortName": "30",
"sortOrder": 2
},
"route9": {
"longName": "Express route",
"mode": "BUS",
"shortName": "30",
"sortOrder": 2
},
"route10": {
"longName": "Variation of express route",
"mode": "BUS",
"shortName": "30",
"sortOrder": 2
},
"route11": {
"longName": "Local route",
"mode": "BUS",
"shortName": "6",
"sortOrder": 2
},
"route12": {
"longName": "Intercity Train",
"mode": "RAIL",
"shortName": "IC",
"sortOrder": 2
},
"route13": {
"longName": "Yellow line Subway",
"mode": "SUBWAY",
"shortName": "Yellow",
"sortOrder": 2
},
"route14": {
"longName": "Xpress route C",
"mode": "BUS",
"shortName": "30C",
"sortOrder": 2
},
"route15": {
"longName": "Express route X",
"mode": "BUS",
"shortName": "30X",
"sortOrder": 2
}
}
247 changes: 247 additions & 0 deletions __tests__/util/__snapshots__/itinerary.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`util > itinerary routeComparator should prioritize routes with integer shortNames over alphabetic shortNames 1`] = `
Array [
Object {
"longName": "A-line",
"mode": "BUS",
"shortName": "A",
"sortOrder": -999,
},
Object {
"longName": "Loop route",
"mode": "BUS",
"shortName": "2",
"sortOrder": -999,
},
]
`;

exports[`util > itinerary routeComparator should prioritize routes with shortNames over those with just longNames 1`] = `
Array [
Object {
"longName": "B-line",
"mode": "BUS",
"shortName": "B",
"sortOrder": -999,
},
Object {
"longName": "A meandering route",
"mode": "BUS",
"sortOrder": -999,
},
]
`;

exports[`util > itinerary routeComparator should prioritize routes with valid sortOrder 1`] = `
Array [
Object {
"longName": "Around town",
"mode": "BUS",
"shortName": "20",
"sortOrder": 2,
},
Object {
"longName": "Around another town",
"mode": "BUS",
"shortName": "3",
"sortOrder": -999,
},
]
`;

exports[`util > itinerary routeComparator should sort based off of route type 1`] = `
Array [
Object {
"longName": "Yellow line Subway",
"mode": "SUBWAY",
"shortName": "Yellow",
"sortOrder": 2,
},
Object {
"longName": "Intercity Train",
"mode": "RAIL",
"shortName": "IC",
"sortOrder": 2,
},
]
`;

exports[`util > itinerary routeComparator should sort routes based off of integer shortName 1`] = `
Array [
Object {
"longName": "Loop route",
"mode": "BUS",
"shortName": "2",
"sortOrder": -999,
},
Object {
"longName": "Around another town",
"mode": "BUS",
"shortName": "3",
"sortOrder": -999,
},
]
`;

exports[`util > itinerary routeComparator should sort routes based off of longNames 1`] = `
Array [
Object {
"longName": "Express route",
"mode": "BUS",
"shortName": "30",
"sortOrder": 2,
},
Object {
"longName": "Variation of express route",
"mode": "BUS",
"shortName": "30",
"sortOrder": 2,
},
]
`;

exports[`util > itinerary routeComparator should sort routes based off of shortNames 1`] = `
Array [
Object {
"longName": "A-line",
"mode": "BUS",
"shortName": "A",
"sortOrder": -999,
},
Object {
"longName": "B-line",
"mode": "BUS",
"shortName": "B",
"sortOrder": -999,
},
]
`;

exports[`util > itinerary routeComparator should sort routes based off of sortOrder 1`] = `
Array [
Object {
"longName": "Around town",
"mode": "BUS",
"shortName": "20",
"sortOrder": 2,
},
Object {
"longName": "Across town",
"mode": "BUS",
"shortName": "10",
"sortOrder": 10,
},
]
`;

exports[`util > itinerary routeComparator should sort routes on all of the criteria at once 1`] = `
Array [
Object {
"longName": "Yellow line Subway",
"mode": "SUBWAY",
"shortName": "Yellow",
"sortOrder": 2,
},
Object {
"longName": "Intercity Train",
"mode": "RAIL",
"shortName": "IC",
"sortOrder": 2,
},
Object {
"longName": "Local route",
"mode": "BUS",
"shortName": "6",
"sortOrder": 2,
},
Object {
"longName": "Around town",
"mode": "BUS",
"shortName": "20",
"sortOrder": 2,
},
Object {
"longName": "Express route",
"mode": "BUS",
"shortName": "30",
"sortOrder": 2,
},
Object {
"longName": "Variation of express route",
"mode": "BUS",
"shortName": "30",
"sortOrder": 2,
},
Object {
"longName": "Zig-zagging route",
"mode": "BUS",
"shortName": "30",
"sortOrder": 2,
},
Object {
"longName": "Xpress route C",
"mode": "BUS",
"shortName": "30C",
"sortOrder": 2,
},
Object {
"longName": "Express route X",
"mode": "BUS",
"shortName": "30X",
"sortOrder": 2,
},
Object {
"longName": "Across town",
"mode": "BUS",
"shortName": "10",
"sortOrder": 10,
},
Object {
"longName": "A-line",
"mode": "BUS",
"shortName": "A",
"sortOrder": -999,
},
Object {
"longName": "B-line",
"mode": "BUS",
"shortName": "B",
"sortOrder": -999,
},
Object {
"longName": "Loop route",
"mode": "BUS",
"shortName": "2",
"sortOrder": -999,
},
Object {
"longName": "Around another town",
"mode": "BUS",
"shortName": "3",
"sortOrder": -999,
},
Object {
"longName": "A meandering route",
"mode": "BUS",
"sortOrder": -999,
},
]
`;

exports[`util > itinerary routeComparator should sort routes with alphanumeric shortNames 1`] = `
Array [
Object {
"longName": "Xpress route C",
"mode": "BUS",
"shortName": "30C",
"sortOrder": 2,
},
Object {
"longName": "Express route X",
"mode": "BUS",
"shortName": "30X",
"sortOrder": 2,
},
]
`;
Loading

0 comments on commit a16abb4

Please sign in to comment.