Skip to content

Commit

Permalink
feat: #1125: Update codes based on reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
nphivu414 committed May 13, 2020
1 parent e2e5db9 commit 9b6b4d7
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 191 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports[`ClientAppDetailManage should match a snapshot 1`] = `
"entries": Array [
Object {
"hash": "",
"key": "3glyf9",
"key": "w0nkbv",
"pathname": "/",
"search": "",
"state": undefined,
Expand All @@ -50,7 +50,7 @@ exports[`ClientAppDetailManage should match a snapshot 1`] = `
"listen": [Function],
"location": Object {
"hash": "",
"key": "3glyf9",
"key": "w0nkbv",
"pathname": "/",
"search": "",
"state": undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports[`ClientAppDetail should match a snapshot 1`] = `
"entries": Array [
Object {
"hash": "",
"key": "to3pvn",
"key": "x8a4cq",
"pathname": "/",
"search": "",
"state": undefined,
Expand All @@ -52,7 +52,7 @@ exports[`ClientAppDetail should match a snapshot 1`] = `
"listen": [Function],
"location": Object {
"hash": "",
"key": "to3pvn",
"key": "x8a4cq",
"pathname": "/",
"search": "",
"state": undefined,
Expand Down Expand Up @@ -848,10 +848,6 @@ exports[`ClientAppDetail should match a snapshot 1`] = `
title="Confirm Peter's Properties installation"
visible={false}
/>
<Component
afterClose={[Function]}
visible={false}
/>
</ClientAppInstallConfirmation>
</div>
</ClientAppDetail>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ exports[`DeveloperAppDetail should match a snapshot 1`] = `
"entries": Array [
Object {
"hash": "",
"key": "1dzv0n",
"key": "4x6531",
"pathname": "/",
"search": "",
"state": undefined,
Expand All @@ -94,7 +94,7 @@ exports[`DeveloperAppDetail should match a snapshot 1`] = `
"listen": [Function],
"location": Object {
"hash": "",
"key": "1dzv0n",
"key": "4x6531",
"pathname": "/",
"search": "",
"state": undefined,
Expand Down Expand Up @@ -959,110 +959,6 @@ exports[`DeveloperAppDetail should match a snapshot 1`] = `
</div>
</Component>
</AppContent>
<AppDeleteModalWithRedux
afterClose={[Function]}
appId="9b6fd5f7-2c15-483d-b925-01b650538e52"
appName="Peter's Properties"
onDeleteSuccess={[Function]}
visible={false}
>
<Component
afterClose={[Function]}
appDeleteRequest={[Function]}
appId="9b6fd5f7-2c15-483d-b925-01b650538e52"
appName="Peter's Properties"
onDeleteSuccess={[Function]}
visible={false}
>
<Component
afterClose={[Function]}
renderChildren={true}
visible={false}
/>
</Component>
</AppDeleteModalWithRedux>
<Component
afterClose={[Function]}
appId="9b6fd5f7-2c15-483d-b925-01b650538e52"
appName="Peter's Properties"
onUninstallSuccess={[Function]}
visible={false}
>
<Component
afterClose={[Function]}
renderChildren={true}
visible={false}
/>
</Component>
<AppRevisionModal
afterClose={[Function]}
appDetailState={
Object {
"data": Object {
"description": "enim facilisis gravida neque convallis a cras semper auctor neque vitae tempus quam
pellentesque nec nam aliquam sem et tortor consequat id porta nibh venenatis cras
sed felis eget velit aliquet sagittis id consectetur purus ut faucibus pulvinar
elementum integer enim neque volutpat ac tincidunt vitae semper quis lectus nulla
at volutpat diam ut venenatis tellus in metus vulputate eu scelerisque felis imperdiet
proin fermentum leo vel orci porta non pulvinar neque laoreet suspendisse interdum co",
"developer": "Pete's Proptech World Ltd",
"homePage": "http://myawesomeproptechproduct.io",
"id": "9b6fd5f7-2c15-483d-b925-01b650538e52",
"media": Array [
Object {
"description": "Application Icon",
"type": "icon",
"uri": "https://reapit-app-store-app-media.s3.eu-west-2.amazonaws.com/7d88729f-2366-4561-9d5c-282615f3946b.jpeg",
},
Object {
"description": "Application Image",
"type": "image",
"uri": "https://reapit-app-store-app-media.s3.eu-west-2.amazonaws.com/c4a36706-aa44-47f9-9fb6-9053eef4e581.png",
},
Object {
"description": "Application Image",
"type": "image",
"uri": "https://reapit-app-store-app-media.s3.eu-west-2.amazonaws.com/65bd3b97-e78c-41cd-b75f-e06e1d2f00df.png",
},
],
"name": "Peter's Properties",
"scopes": Array [
Object {
"description": "Read data about developers",
"name": "Marketplace/developers.read",
},
Object {
"description": "Write data about developers",
"name": "Marketplace/developers.write",
},
],
"summary": "vitae elementum curabitur vitae nunc sed velit eget gravida cum sociis natoque!!",
"supportEmail": "[email protected]",
"telephone": "0113 288 2900",
},
"isAppDetailLoading": false,
}
}
appId="9b6fd5f7-2c15-483d-b925-01b650538e52"
visible={false}
>
<Component
afterClose={[Function]}
footerItems={
<Unknown
dataTest="revision-approve-button"
disabled={false}
onClick={[Function]}
type="button"
variant="primary"
>
CANCEL PENDING REVISIONS
</Unknown>
}
title="Pending Revisions"
visible={false}
/>
</AppRevisionModal>
</div>
</DeveloperAppDetail>
</Router>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,36 @@ const DeveloperAppDetail: React.FC<DeveloperAppDetailProps> = () => {
)}
/>
<AppContent appDetailData={appDetailData} loginType={loginType} />
<AppDelete
appId={id}
appName={name}
afterClose={closeDeleteAppModal(setIsDeleteModalOpen)}
visible={isDeleteModalOpen}
onDeleteSuccess={handleOnDeleteAppSuccess(history)}
/>

<AppInstallations
appId={id}
appName={name}
visible={isInstallationsModalOpen}
afterClose={closeInstallationsModal(setIsInstallationsModalOpen)}
onUninstallSuccess={closeInstallationsModal(setIsInstallationsModalOpen)}
/>
{isDeleteModalOpen && (
<AppDelete
appId={id}
appName={name}
afterClose={closeDeleteAppModal(setIsDeleteModalOpen)}
visible={isDeleteModalOpen}
onDeleteSuccess={handleOnDeleteAppSuccess(history)}
/>
)}

{isInstallationsModalOpen && (
<AppInstallations
appId={id}
appName={name}
visible={isInstallationsModalOpen}
afterClose={closeInstallationsModal(setIsInstallationsModalOpen)}
onUninstallSuccess={closeInstallationsModal(setIsInstallationsModalOpen)}
/>
)}

{isAppRevisionComparisionModalOpen && (
<AppRevisionModal
visible={isAppRevisionComparisionModalOpen}
appId={id}
appDetailState={appDetailState}
afterClose={closeAppRevisionComparisionModal(setIsAppRevisionComparisionModalOpen)}
/>
)}

<AppRevisionModal
visible={isAppRevisionComparisionModalOpen}
appId={id}
appDetailState={appDetailState}
afterClose={closeAppRevisionComparisionModal(setIsAppRevisionComparisionModalOpen)}
/>
{isLoadingAppDetail && <Loader />}
</div>
)
Expand Down
5 changes: 4 additions & 1 deletion packages/marketplace/src/components/pages/developer-home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ export const DeveloperHome: React.FunctionComponent<DeveloperProps> = ({

if (location && location.search) {
const pageQueryString = getParamValueFromPath(location.search, 'page')
pageNumber = Number(pageQueryString) > 0 ? Number(pageQueryString) : 1
if (pageQueryString) {
pageNumber = Number(pageQueryString)
}
}

const unfetched = !developerState.developerData
const loading = developerState.loading
const list = developerState?.developerData?.data?.data || []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@ const AppContent: React.FC<AppContentProps> = ({ appDetailData, loginType }) =>
speed: 500,
variableWidth: true,
prevArrow: (
// @ts-ignore
<SlickButtonNav>
<ChevronLeftIcon />
</SlickButtonNav>
),
nextArrow: (
// @ts-ignore
<SlickButtonNav>
<ChevronLeftIcon />
</SlickButtonNav>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports[`ClientAppInstallConfirmation should match a snapshot 1`] = `
"entries": Array [
Object {
"hash": "",
"key": "49wyie",
"key": "9ujcw5",
"pathname": "/",
"search": "",
"state": undefined,
Expand All @@ -37,7 +37,7 @@ exports[`ClientAppInstallConfirmation should match a snapshot 1`] = `
"listen": [Function],
"location": Object {
"hash": "",
"key": "49wyie",
"key": "9ujcw5",
"pathname": "/",
"search": "",
"state": undefined,
Expand Down Expand Up @@ -122,10 +122,6 @@ exports[`ClientAppInstallConfirmation should match a snapshot 1`] = `
title="Confirm Peter's Properties installation"
visible={true}
/>
<Component
afterClose={[Function]}
visible={false}
/>
</ClientAppInstallConfirmation>
</Router>
</Provider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ClientAppUninstallConfirmation renderUninstallConfirmationModalFooter should match snapshot 1`] = `
<div>
<Component
dataTest="agree-btn"
loading={false}
onClick={[Function]}
type="button"
variant="primary"
>
Confirm
</Component>
<Component
dataTest="disagree-btn"
disabled={false}
onClick={[MockFunction]}
type="button"
variant="danger"
>
Cancel
</Component>
</div>
`;

exports[`ClientAppUninstallConfirmation should match a snapshot 1`] = `
<Provider
store={
Expand All @@ -23,7 +46,7 @@ exports[`ClientAppUninstallConfirmation should match a snapshot 1`] = `
"entries": Array [
Object {
"hash": "",
"key": "vclqtp",
"key": "ua2k3p",
"pathname": "/",
"search": "",
"state": undefined,
Expand All @@ -37,7 +60,7 @@ exports[`ClientAppUninstallConfirmation should match a snapshot 1`] = `
"listen": [Function],
"location": Object {
"hash": "",
"key": "vclqtp",
"key": "ua2k3p",
"pathname": "/",
"search": "",
"state": undefined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import * as ReactRedux from 'react-redux'
import { ReduxState } from '@/types/core'
import { mount } from 'enzyme'
import { mount, shallow } from 'enzyme'
import configureStore from 'redux-mock-store'
import { Router } from 'react-router'
import { createMemoryHistory } from 'history'
Expand All @@ -15,6 +15,7 @@ import ClientAppUninstallConfirmation, {
handleUninstallAppSuccessCallback,
handleSuccessAlertButtonClick,
handleSuccessAlertMessageAfterClose,
renderUninstallConfirmationModalFooter,
} from '../client-app-uninstall-confirmation'

const mockState = {
Expand Down Expand Up @@ -126,4 +127,22 @@ describe('ClientAppUninstallConfirmation', () => {
fn()
expect(mockFunction).toBeCalledWith(false)
})
describe('renderUninstallConfirmationModalFooter', () => {
it('should match snapshot', () => {
const wrapper = shallow(
<div>
{renderUninstallConfirmationModalFooter(
false,
appId,
clientId,
installationId,
spyDispatch,
jest.fn(),
jest.fn(),
)}
</div>,
)
expect(wrapper).toMatchSnapshot()
})
})
})
Loading

0 comments on commit 9b6b4d7

Please sign in to comment.