-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from opentripplanner/dev
Next release
- Loading branch information
Showing
103 changed files
with
7,094 additions
and
2,855 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// FIXME: This file has been renamed because formChanged is no longer | ||
// triggering debounces. See https://github.com/opentripplanner/otp-react-redux/pull/62#discussion_r298272504 | ||
// NOTE: Commenting out the entire test file causes a failure because at least | ||
// one test must be run per test file. | ||
// TODO: write tests for form actions | ||
|
||
/* globals describe, expect, it, jest */ | ||
|
||
import { timeoutPromise } from '../test-utils' | ||
|
||
import { formChanged } from '../../lib/actions/form' | ||
|
||
describe('actions > api > form', () => { | ||
it('should debounce numerous requests to plan a trip', async () => { | ||
const queries = [ | ||
// Query 1 | ||
{ | ||
from: { lat: 12, lon: 34 }, | ||
to: { lat: 34, lon: 12 } | ||
}, | ||
// Query 2 (from location changed) | ||
{ | ||
from: { lat: 11, lon: 33 }, | ||
to: { lat: 34, lon: 12 } | ||
} | ||
] | ||
const defaultState = { | ||
otp: { | ||
config: { | ||
api: { | ||
host: 'http://mock-host.com', | ||
path: '/api', | ||
port: 80 | ||
}, | ||
autoPlan: true, | ||
debouncePlanTimeMs: 500 | ||
}, | ||
currentQuery: queries[0], | ||
searches: [] | ||
} | ||
} | ||
|
||
const mockDispatch = jest.fn() | ||
for (var i = 0; i < 10; i++) { | ||
// Alternate back and forth between two queries on each iteration. | ||
const formChangedAction = formChanged(queries[i % 2], queries[(i + 1) % 2]) | ||
formChangedAction(mockDispatch, () => defaultState) | ||
} | ||
|
||
// wait for request to complete | ||
await timeoutPromise(1000) | ||
|
||
expect(mockDispatch.mock.calls).toMatchSnapshot() | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.