Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/shared/modules/discovery/discoveryDuck.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export const discoveryOnStartupEpic = (some$, store) => {
// fake discovery response
// Promise.resolve({ bolt: 'bolt+routing://localhost:7687' })
.then(result => {
const host = result && (result.bolt_direct || result.bolt)
const host =
result &&
(result.bolt_routing || result.bolt_direct || result.bolt)
// Try to get info from server
if (!host) {
throw new Error('No bolt address found') // No bolt info from server, throw
Expand Down
24 changes: 24 additions & 0 deletions src/shared/modules/discovery/discoveryDuck.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,30 @@ describe('discoveryOnStartupEpic', () => {
// When
store.dispatch(action)
})
test('listens on APP_START and finds all of bolt_routing, bolt_direct and a bold host and dispatches an action with the found bolt_routing host', done => {
// Given
const action = { type: APP_START, env: WEB }
const expectedHost = 'neo4j://myhost:7777'
nock(getDiscoveryEndpoint())
.get('/')
.reply(200, {
bolt_routing: expectedHost,
bolt_direct: 'bolt://myhost:666',
bolt: 'very://bad:1337'
})
bus.take(discovery.DONE, currentAction => {
// Then
expect(store.getActions()).toEqual([
action,
discovery.updateDiscoveryConnection({ host: expectedHost }),
{ type: discovery.DONE }
])
done()
})

// When
store.dispatch(action)
})
test('listens on APP_START and reads bolt URL from location URL and dispatches an action with the found host', done => {
// Given
const action = {
Expand Down