Skip to content

Commit

Permalink
fix: #1997 fix admin redirect modal on marketplace
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined committed Jul 17, 2020
1 parent e1ea44c commit 34e0afd
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`HandleLegacyAdminRoutesModal HandleLegacyAdminRoutesModal - should match snapshoot 1`] = `
<HandleLegacyAdminRoutesModal>
<Component
footerItems={
<React.Fragment>
<Unknown
onClick={[Function]}
type="button"
variant="primary"
>
Go there now
</Unknown>
<Unknown
onClick={[Function]}
type="button"
variant="primary"
>
Back to Marketplace
</Unknown>
</React.Fragment>
}
tapOutsideToDissmiss={false}
title="Looking for the admin portal?"
visible={true}
/>
</HandleLegacyAdminRoutesModal>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import routes from '@/constants/routes'
import { mount } from 'enzyme'
import HandleLegacyAdminRoutesModal, {
handleBtnBackToMarketplace,
handleBtnGoThereNow,
} from '../handle-legacy-admin-routes-modal'

jest.mock('@/core/router', () => ({
history: {
push: jest.fn(),
},
}))
import { history } from '@/core/router'

describe('HandleLegacyAdminRoutesModal', () => {
test('handleBtnBackToMarketplace should work correctly', () => {
handleBtnBackToMarketplace()
expect(history.push).toHaveBeenCalledWith(routes.APPS)
})

test('handleBtnGoTherNow should work correctly', () => {
window.open = jest.fn()
handleBtnGoThereNow()
expect(window.open).toHaveBeenCalledWith(window.reapit.config.adminPortalUrl, '_self')
})

test('HandleLegacyAdminRoutesModal - should match snapshoot', () => {
expect(mount(<HandleLegacyAdminRoutesModal />)).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const handleBtnBackToMarketplace = () => {
}

export const handleBtnGoThereNow = () => {
window.open(window.reapit.config.developerPortalUrl, '_self')
window.open(window.reapit.config.adminPortalUrl, '_self')
}

const HandleLegacyAdminRoutesModal: React.FC<{}> = () => {
Expand Down

0 comments on commit 34e0afd

Please sign in to comment.