Skip to content

Commit

Permalink
feat #1210: fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined committed May 20, 2020
1 parent eedf991 commit e509fc1
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react'
import { DeveloperAppDetailState } from '@/reducers/developer'
import { Aside, ManageApp, renderListedStatus } from '../aside'
import { shallow } from 'enzyme'
import toJson from 'enzyme-to-json'
import { integrationTypesStub } from '@/sagas/__stubs__/integration-types'
import { appDetailDataStub } from '@/sagas/__stubs__/app-detail'
import { DesktopIntegrationTypeModel } from '@reapit/foundations-ts-definitions'
Expand All @@ -15,13 +14,11 @@ jest.mock('react-router', () => ({
describe('Aside', () => {
test('Aside - should match snapshot', () => {
expect(
toJson(
shallow(
<Aside
appDetailState={appDetailDataStub as DeveloperAppDetailState}
desktopIntegrationTypes={integrationTypesStub.data as DesktopIntegrationTypeModel[]}
/>,
),
shallow(
<Aside
appDetailState={appDetailDataStub as DeveloperAppDetailState}
desktopIntegrationTypes={integrationTypesStub.data as DesktopIntegrationTypeModel[]}
/>,
),
).toMatchSnapshot()
})
Expand All @@ -43,14 +40,8 @@ describe('Aside', () => {

test('ManageApp - should match snapshot', () => {
expect(
toJson(
shallow(
<ManageApp
id="test"
pendingRevisions={false}
appDetailState={appDetailDataStub as DeveloperAppDetailState}
/>,
),
shallow(
<ManageApp id="test" pendingRevisions={false} appDetailState={appDetailDataStub as DeveloperAppDetailState} />,
),
).toMatchSnapshot()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import { GET_ALL_PAGE_SIZE } from '@/constants/paginator'
import { InstallationModel } from '@reapit/foundations-ts-definitions'
import { installationsStub } from '@/sagas/__stubs__/installations'
import { shallow, mount } from 'enzyme'
Expand Down Expand Up @@ -65,7 +66,7 @@ describe('AppContent', () => {
appInstallationsRequestData({
appId: [appId],
pageNumber: 1,
pageSize: 15,
pageSize: GET_ALL_PAGE_SIZE,
isInstalled: true,
developerId: [developerId],
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'
import { GET_ALL_PAGE_SIZE } from '@/constants/paginator'
import { appInstallationsRequestData } from '@/actions/app-installations'
import { selectDeveloperId } from '@/selector'
import developerAppDetailStyles from '@/styles/pages/developer-app-detail.scss?mod'
Expand Down Expand Up @@ -67,7 +68,7 @@ export const handleUninstallSuccess = ({ handleAfterClose, setUninstallApp, deve
appInstallationsRequestData({
appId: [appId],
pageNumber: 1,
pageSize: 15,
pageSize: GET_ALL_PAGE_SIZE,
isInstalled: true,
developerId: [developerId],
}),
Expand All @@ -83,6 +84,7 @@ const AppContent: React.FC<AppContentProps> = ({ appDetailData }) => {

const [uninstallApp, setUninstallApp] = React.useState<InstallationModel>()
const columns = generateColumns(handleUninstall(setUninstallApp))()
const isVisibleUninstallModal = Boolean(uninstallApp)

/**
* 0 = icon
Expand All @@ -92,7 +94,7 @@ const AppContent: React.FC<AppContentProps> = ({ appDetailData }) => {

return (
<div className={clientAppDetailStyles.appContentContainer}>
<Modal visible={Boolean(uninstallApp)}>
<Modal visible={isVisibleUninstallModal}>
<ConfirmUninstall
isSetAppDetailStaleAfterUninstallSuccess={false}
appName={name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import appDetailStyles from '@/styles/blocks/app-detail.scss?mod'
import developerAppDetailStyles from '@/styles/pages/developer-app-detail.scss?mod'
import { RenderWithHeader } from './app-detail/render-with-header'
import { Button } from '@reapit/elements'
import { BooleanToYesNo } from '@/utils/boolean-to-yes-no'
import { convertBooleanToYesNoString } from '@/utils/boolean-to-yes-no-string'
import { renderCategory, renderDesktopIntegrationTypes } from '../client-app-detail/app-content'
import { DesktopIntegrationTypeModel } from '@reapit/foundations-ts-definitions'
/* eslint-disable max-len */
Expand Down Expand Up @@ -105,8 +105,8 @@ export const Aside: React.FC<AsideProps> = ({ desktopIntegrationTypes, appDetail
<div className={developerAppDetailStyles.headerWithoutMargin}>
{renderDesktopIntegrationTypes(desktopIntegrationTypes)}
</div>
<RenderWithHeader header="Private App">{BooleanToYesNo(Boolean(limitToClientIds))}</RenderWithHeader>
<RenderWithHeader header="Direct API">{BooleanToYesNo(Boolean(isDirectApi))}</RenderWithHeader>
<RenderWithHeader header="Private App">{convertBooleanToYesNoString(Boolean(limitToClientIds))}</RenderWithHeader>
<RenderWithHeader header="Direct API">{convertBooleanToYesNoString(Boolean(isDirectApi))}</RenderWithHeader>
<RenderWithHeader header="Status">{renderListedStatus(Boolean(isListed))}</RenderWithHeader>
<ManageApp appDetailState={appDetailState} id={id} pendingRevisions={Boolean(pendingRevisions)} />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { convertBooleanToYesNoString } from '../boolean-to-yes-no-string'
describe('convertBooleanToYesNoString', () => {
it('should return Yes when input true', () => {
expect(convertBooleanToYesNoString(true)).toBe('Yes')
})
it('should return No when input fasle', () => {
expect(convertBooleanToYesNoString(false)).toBe('No')
})
})

This file was deleted.

7 changes: 7 additions & 0 deletions packages/marketplace/src/utils/boolean-to-yes-no-string.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const convertBooleanToYesNoString: (value: boolean) => string = value => {
if (value) {
return 'Yes'
}

return 'No'
}
7 changes: 0 additions & 7 deletions packages/marketplace/src/utils/boolean-to-yes-no.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions packages/marketplace/src/utils/route-dispatcher.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AdminDevManagementRequestDataValues } from './../actions/admin-dev-management'
import { GET_ALL_PAGE_SIZE } from '@/constants/paginator'
import { selectDeveloperId } from '@/selector'
import { appDetailRequestData } from './../actions/app-detail'
import { RouteValue, StringMap } from '../types/core'
import Routes from '../constants/routes'
import { GET_ALL_PAGE_SIZE } from '../constants/paginator'
import store from '../core/store'
import { clientFetchAppSummary, clientFetchAppDetail } from '../actions/client'
import { myAppsRequestData } from '../actions/my-apps'
Expand Down Expand Up @@ -78,7 +78,7 @@ const routeDispatcher = async (route: RouteValue, params?: StringMap, search?: s
appInstallationsRequestData({
appId: [id],
pageNumber: 1,
pageSize: 15,
pageSize: GET_ALL_PAGE_SIZE,
isInstalled: true,
developerId: [developerId],
}),
Expand Down

0 comments on commit e509fc1

Please sign in to comment.