Skip to content

Commit

Permalink
Merge pull request #109 from jaegertracing/issue-92-browser-prompt-error
Browse files Browse the repository at this point in the history
Fix #92 browser prompt error
  • Loading branch information
tiffon authored Oct 27, 2017
2 parents 4e02e45 + 53e9a92 commit 01fd7f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/reducers/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ function fetchStarted(state) {
}

function fetchServicesDone(state, { payload }) {
const services = payload.data;
if (Array.isArray(services)) {
services.sort(baseStringComparator);
}
const services = payload.data || [];
services.sort(baseStringComparator);
return { ...state, services, error: null, loading: false };
}

Expand Down
14 changes: 14 additions & 0 deletions src/reducers/services.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ function verifyInitialState() {
beforeEach(verifyInitialState);
afterEach(verifyInitialState);

it('#92 - ensures services is at least an empty array', () => {
const services = null;
const state = serviceReducer(initialState, {
type: `${fetchServices}_FULFILLED`,
payload: { data: services },
});
expect(state).toEqual({
services: [],
operationsForService: {},
loading: false,
error: null,
});
});

it('should handle a fetch services with loading state', () => {
const state = serviceReducer(initialState, {
type: `${fetchServices}_PENDING`,
Expand Down

0 comments on commit 01fd7f4

Please sign in to comment.