-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: #1997 fix admin redirect modal on marketplace
- Loading branch information
undefined
committed
Jul 17, 2020
1 parent
e1ea44c
commit 34e0afd
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...es/handle-legacy-routes/__tests__/__snapshots__/handle-legacy-admin-routes-modal.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |
31 changes: 31 additions & 0 deletions
31
.../src/components/pages/handle-legacy-routes/__tests__/handle-legacy-admin-routes-modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters