Skip to content

Commit

Permalink
Merge pull request jaegertracing#109 from jaegertracing/issue-92-brow…
Browse files Browse the repository at this point in the history
…ser-prompt-error

Fix jaegertracing#92 browser prompt error
Signed-off-by: vvvprabhakar <[email protected]>
  • Loading branch information
tiffon authored Oct 27, 2017
2 parents 130526e + eddba40 commit a9e3a7b
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 a9e3a7b

Please sign in to comment.