diff --git a/src/discoverServices.js b/src/discoverServices.js index 405fbe18a..98e6a4c43 100644 --- a/src/discoverServices.js +++ b/src/discoverServices.js @@ -258,9 +258,7 @@ export function discoveryReducer(state = {}, action) { ...action.data.uiModules.map((d) => { return { name: d.id, - interfaces: d.provides?.map((i) => { - return { name: i.id + ' ' + i.version }; - }) || [], + interfaces: [], }; }) diff --git a/src/discoverServices.test.js b/src/discoverServices.test.js index c6cd08fbf..9afabedc8 100644 --- a/src/discoverServices.test.js +++ b/src/discoverServices.test.js @@ -98,6 +98,42 @@ describe('discoverServices', () => { }); describe('discoveryReducer', () => { + it('handles DISCOVERY_APPLICATIONS', () => { + let state = {}; + const moduleDescriptors = [ + { id: 'mod-a' }, + { id: 'mod-b' }, + ]; + const uiModules = [ + { id: 'folio_c' }, + { id: 'folio_d' }, + ]; + const action = { + type: 'DISCOVERY_APPLICATIONS', + data: { + id: 'a', + moduleDescriptors, + uiModules, + }, + }; + + const mapped = { + applications: { + [action.data.id]: { + name: action.data.id, + modules: [ + ...moduleDescriptors.map((d) => ({ name: d.id, interfaces: [] })), + ...uiModules.map((d) => ({ name: d.id, interfaces: [] })), + ], + }, + }, + }; + + state = discoveryReducer(state, action); + + expect(state).toMatchObject(mapped); + }); + it('handles DISCOVERY_OKAPI', () => { let state = { okapi: '0.0.0'