diff --git a/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js b/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js index 74f0b343f..c6ce9d1e3 100644 --- a/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js +++ b/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js @@ -2,15 +2,14 @@ import { getIframeSrc } from '../getIframeSrc.js' const appDetails = { launchUrl: 'debug/dev' } const dashboardItem = { id: 'rainbowdashitem' } +const expectedSrc = `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}` describe('getIframeSrc', () => { it('no ou filter', () => { const ouFilter = [] const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) - expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}` - ) + expect(src).toEqual(expectedSrc) }) it('should return the correct iframe src', () => { @@ -27,12 +26,9 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=fdc6uOvgoji,lc3eMKXaEfw` + `${expectedSrc}&userOrgUnit=fdc6uOvgoji,lc3eMKXaEfw` ) }) @@ -49,12 +45,9 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=OU_GROUP-b0EsAxm8Nge,lc3eMKXaEfw` + `${expectedSrc}&userOrgUnit=OU_GROUP-b0EsAxm8Nge,lc3eMKXaEfw` ) }) @@ -71,12 +64,9 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=LEVEL-m9lBJogzE95,fdc6uOvgoji` + `${expectedSrc}&userOrgUnit=LEVEL-m9lBJogzE95,fdc6uOvgoji` ) }) @@ -88,13 +78,8 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) - expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=USER_ORGUNIT` - ) + expect(src).toEqual(`${expectedSrc}&userOrgUnit=USER_ORGUNIT`) }) it('all user org units in filter', () => { @@ -113,12 +98,9 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=USER_ORGUNIT_CHILDREN,USER_ORGUNIT_GRANDCHILDREN,USER_ORGUNIT` + `${expectedSrc}&userOrgUnit=USER_ORGUNIT_CHILDREN,USER_ORGUNIT_GRANDCHILDREN,USER_ORGUNIT` ) }) }) diff --git a/src/components/Item/AppItem/getIframeSrc.js b/src/components/Item/AppItem/getIframeSrc.js index 42fe7d4bc..ae2b1c2c8 100644 --- a/src/components/Item/AppItem/getIframeSrc.js +++ b/src/components/Item/AppItem/getIframeSrc.js @@ -3,8 +3,6 @@ import { FILTER_ORG_UNIT } from '../../../actions/itemFilters.js' export const getIframeSrc = (appDetails, item, itemFilters) => { let iframeSrc = `${appDetails.launchUrl}?dashboardItemId=${item.id}` - console.log('jj itemfilters', itemFilters) - if (itemFilters[FILTER_ORG_UNIT] && itemFilters[FILTER_ORG_UNIT].length) { const ouIds = itemFilters[FILTER_ORG_UNIT].map(({ id, path }) => path ? path.split('/').slice(-1)[0] : id