Skip to content

Commit f162be7

Browse files
authored
Merge pull request #11 from opentripplanner/dev
0.2.0
2 parents 30ed0a7 + dffd054 commit f162be7

30 files changed

+2342
-1191
lines changed

.gitignore

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1+
# macOS
12
.DS_Store
2-
tmp
3+
4+
# node stuff
35
node_modules
4-
config.yml
56
*.log
7+
8+
# transpiled files
9+
build/*
10+
11+
# testing stuff
12+
tmp
13+
coverage
14+
15+
# secrets
16+
config.yml

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ node_js:
77
- '6'
88
after_success:
99
- npm run semantic-release
10+
before_script:
11+
- yarn global add codecov
1012
script:
11-
- yarn test
13+
- yarn run lint
14+
- yarn run lint-docs
15+
- yarn run cover
16+
- codecov
1217
branches:
1318
except:
1419
- /^v\d+\.\d+\.\d+$/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`actions > api should make a query to OTP 1`] = `"/api/plan?arriveBy=false&fromPlace=12%2C34&showIntermediateStops=true&toPlace=34%2C12"`;
4+
5+
exports[`actions > api should make a query to OTP 2`] = `
6+
Array [
7+
Array [
8+
Object {
9+
"type": "PLAN_REQUEST",
10+
},
11+
],
12+
Array [
13+
Object {
14+
"payload": Object {
15+
"fake": "response",
16+
},
17+
"type": "PLAN_RESPONSE",
18+
},
19+
],
20+
]
21+
`;

__tests__/actions/api.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* globals describe, expect, it, jest */
2+
3+
import nock from 'nock'
4+
5+
import {planTrip} from '../../lib/actions/api'
6+
7+
function timeoutPromise (ms) {
8+
return new Promise((resolve, reject) => {
9+
setTimeout(resolve, ms)
10+
})
11+
}
12+
13+
const planTripAction = planTrip()
14+
15+
describe('actions > api', () => {
16+
it('should make a query to OTP', async () => {
17+
nock('http://mock-host.com')
18+
.get(/api\/plan/)
19+
.reply(200, {
20+
fake: 'response'
21+
})
22+
.on('request', (req, interceptor) => {
23+
expect(req.path).toMatchSnapshot()
24+
})
25+
26+
const mockDispatch = jest.fn()
27+
planTripAction(mockDispatch, () => {
28+
return {
29+
otp: {
30+
config: {
31+
api: {
32+
host: 'http://mock-host.com',
33+
path: '/api',
34+
port: 80
35+
}
36+
},
37+
currentQuery: {
38+
from: {
39+
lat: 12,
40+
lon: 34
41+
},
42+
to: {
43+
lat: 34,
44+
lon: 12
45+
}
46+
},
47+
searches: []
48+
}
49+
}
50+
})
51+
52+
// wait for request to complete
53+
await timeoutPromise(100)
54+
55+
expect(mockDispatch.mock.calls).toMatchSnapshot()
56+
})
57+
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`util > state getDefaultQuery should parse window hash if available 1`] = `
4+
Object {
5+
"date": "2017-02-03",
6+
"departArrive": "DEPART",
7+
"from": Object {
8+
"lat": "12",
9+
"lon": "34",
10+
"name": "12.00000, 34.00000",
11+
},
12+
"mode": undefined,
13+
"time": "12:34",
14+
"to": Object {
15+
"lat": "34",
16+
"lon": "12",
17+
"name": "34.00000, 12.00000",
18+
},
19+
"type": "ITINERARY",
20+
}
21+
`;

__tests__/util/itinerary.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {isTransit} from '../../lib/util/itinerary'
2+
3+
describe('util > itinerary', () => {
4+
it('isTransit should work', () => {
5+
expect(isTransit('CAR')).toBeFalsy()
6+
})
7+
})

__tests__/util/state.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* globals describe, expect, it */
2+
3+
import {getDefaultQuery} from '../../lib/util/state'
4+
5+
describe('util > state', () => {
6+
it('getDefaultQuery should parse window hash if available', () => {
7+
window.location.hash = '#plan?arriveBy=false&date=2017-02-03&fromPlace=12,34&toPlace=34,12&time=12:34'
8+
expect(getDefaultQuery()).toMatchSnapshot()
9+
})
10+
})

dist/index.css

Lines changed: 58 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,12 @@
1818
margin: 0px;
1919
padding: 0px;
2020
}
21+
22+
button.header, button.step, .intermediate-stops button {
23+
background: inherit;
24+
color: inherit;
25+
border: 0;
26+
text-align: inherit;
27+
text-decoration: none;
28+
width: 100%;
29+
}

0 commit comments

Comments
 (0)