|
@@ -1,3 +1,5 @@
|
|
|
+import {InjectedRouter} from 'react-router';
|
|
|
+
|
|
|
import {initializeOrg} from 'sentry-test/initializeOrg';
|
|
|
|
|
|
import {openModal} from 'sentry/actionCreators/modal';
|
|
@@ -7,7 +9,8 @@ import ProjectsStore from 'sentry/stores/projectsStore';
|
|
|
jest.mock('sentry/actionCreators/modal');
|
|
|
|
|
|
describe('navigation ActionCreator', () => {
|
|
|
- let router;
|
|
|
+ let router: InjectedRouter;
|
|
|
+
|
|
|
beforeEach(() => {
|
|
|
ProjectsStore.init();
|
|
|
const initialData = initializeOrg({
|
|
@@ -27,7 +30,7 @@ describe('navigation ActionCreator', () => {
|
|
|
|
|
|
it('should get project from query parameters', () => {
|
|
|
router.location.query.project = '2';
|
|
|
- expect(navigateTo('/settings/:projectId/alert', router)).toBe();
|
|
|
+ expect(navigateTo('/settings/:projectId/alert', router)).toBe(undefined);
|
|
|
expect(openModal).not.toHaveBeenCalled();
|
|
|
expect(router.push).toHaveBeenCalledWith('/settings/project-slug/alert');
|
|
|
});
|
|
@@ -39,7 +42,7 @@ describe('navigation ActionCreator', () => {
|
|
|
'/organizations/albertos-apples/performance/?project=:project#performance-sidequest',
|
|
|
router
|
|
|
)
|
|
|
- ).toBe();
|
|
|
+ ).toBe(undefined);
|
|
|
expect(openModal).not.toHaveBeenCalled();
|
|
|
expect(router.push).toHaveBeenCalledWith(
|
|
|
'/organizations/albertos-apples/performance/?project=2#performance-sidequest'
|
|
@@ -53,7 +56,7 @@ describe('navigation ActionCreator', () => {
|
|
|
'/settings/:projectId/alert?project=:project#performance-sidequest',
|
|
|
router
|
|
|
)
|
|
|
- ).toBe();
|
|
|
+ ).toBe(undefined);
|
|
|
expect(openModal).not.toHaveBeenCalled();
|
|
|
expect(router.push).toHaveBeenCalledWith(
|
|
|
'/settings/project-slug/alert?project=2#performance-sidequest'
|
|
@@ -62,12 +65,12 @@ describe('navigation ActionCreator', () => {
|
|
|
|
|
|
it('should open modal if the store is somehow missing selected projectId', () => {
|
|
|
router.location.query.project = '911';
|
|
|
- expect(navigateTo('/settings/:projectId/alert', router)).toBe();
|
|
|
+ expect(navigateTo('/settings/:projectId/alert', router)).toBe(undefined);
|
|
|
expect(openModal).toHaveBeenCalled();
|
|
|
});
|
|
|
|
|
|
it('should open modal when no project is selected', () => {
|
|
|
- expect(navigateTo('/settings/:projectId/alert', router)).toBe();
|
|
|
+ expect(navigateTo('/settings/:projectId/alert', router)).toBe(undefined);
|
|
|
expect(openModal).toHaveBeenCalled();
|
|
|
});
|
|
|
|
|
@@ -77,29 +80,30 @@ describe('navigation ActionCreator', () => {
|
|
|
'/organizations/albertos-apples/performance/?project=:project#performance-sidequest',
|
|
|
router
|
|
|
)
|
|
|
- ).toBe();
|
|
|
+ ).toBe(undefined);
|
|
|
expect(openModal).toHaveBeenCalled();
|
|
|
});
|
|
|
|
|
|
it('should open modal if more than one project is selected', () => {
|
|
|
router.location.query.project = ['1', '2', '3'];
|
|
|
- expect(navigateTo('/settings/:projectId/alert', router)).toBe();
|
|
|
+ expect(navigateTo('/settings/:projectId/alert', router)).toBe(undefined);
|
|
|
expect(openModal).toHaveBeenCalled();
|
|
|
});
|
|
|
|
|
|
it('should not open modal if url does not require project id', () => {
|
|
|
- expect(navigateTo('/settings/alert', router)).toBe();
|
|
|
+ expect(navigateTo('/settings/alert', router)).toBe(undefined);
|
|
|
expect(openModal).not.toHaveBeenCalled();
|
|
|
expect(router.push).toHaveBeenCalledWith('/settings/alert');
|
|
|
});
|
|
|
|
|
|
it('should open modal for orgId', () => {
|
|
|
- expect(navigateTo('/settings/:orgId', router)).toBe();
|
|
|
+ expect(navigateTo('/settings/:orgId', router)).toBe(undefined);
|
|
|
expect(openModal).toHaveBeenCalled();
|
|
|
});
|
|
|
|
|
|
it('normalizes URLs for customer domains', function () {
|
|
|
window.__initialData = {
|
|
|
+ ...window.__initialData,
|
|
|
customerDomain: {
|
|
|
subdomain: 'albertos-apples',
|
|
|
organizationUrl: 'https://albertos-apples.sentry.io',
|