1
1
import { ApiApplicationFixture } from 'sentry-fixture/apiApplication' ;
2
2
3
- import { initializeOrg } from 'sentry-test/initializeOrg' ;
4
3
import {
5
4
render ,
6
5
renderGlobalModal ,
@@ -16,8 +15,6 @@ import ApiApplications from 'sentry/views/settings/account/apiApplications';
16
15
jest . mock ( 'sentry/utils/demoMode' ) ;
17
16
18
17
describe ( 'ApiApplications' , ( ) => {
19
- const { routerProps, router} = initializeOrg ( { router : { params : { } } } ) ;
20
-
21
18
beforeEach ( ( ) => {
22
19
MockApiClient . clearMockResponses ( ) ;
23
20
} ) ;
@@ -28,7 +25,7 @@ describe('ApiApplications', () => {
28
25
body : [ ] ,
29
26
} ) ;
30
27
31
- render ( < ApiApplications { ... routerProps } /> ) ;
28
+ render ( < ApiApplications /> ) ;
32
29
await waitForElementToBeRemoved ( ( ) => screen . queryByTestId ( 'loading-indicator' ) ) ;
33
30
34
31
expect (
@@ -42,7 +39,7 @@ describe('ApiApplications', () => {
42
39
body : [ ApiApplicationFixture ( ) ] ,
43
40
} ) ;
44
41
45
- render ( < ApiApplications { ... routerProps } /> ) ;
42
+ render ( < ApiApplications /> ) ;
46
43
await waitForElementToBeRemoved ( ( ) => screen . queryByTestId ( 'loading-indicator' ) ) ;
47
44
48
45
expect ( requestMock ) . toHaveBeenCalled ( ) ;
@@ -58,7 +55,7 @@ describe('ApiApplications', () => {
58
55
body : [ ApiApplicationFixture ( ) ] ,
59
56
} ) ;
60
57
61
- render ( < ApiApplications { ... routerProps } /> ) ;
58
+ render ( < ApiApplications /> ) ;
62
59
63
60
expect (
64
61
await screen . findByText ( "You haven't created any applications yet." )
@@ -80,7 +77,7 @@ describe('ApiApplications', () => {
80
77
method : 'POST' ,
81
78
} ) ;
82
79
83
- render ( < ApiApplications { ... routerProps } /> ) ;
80
+ const { router } = render ( < ApiApplications /> ) ;
84
81
await waitForElementToBeRemoved ( ( ) => screen . queryByTestId ( 'loading-indicator' ) ) ;
85
82
86
83
await userEvent . click ( screen . getByLabelText ( 'Create New Application' ) ) ;
@@ -91,8 +88,11 @@ describe('ApiApplications', () => {
91
88
) ;
92
89
93
90
await waitFor ( ( ) => {
94
- expect ( router . push ) . toHaveBeenLastCalledWith (
95
- '/settings/account/api/applications/234/'
91
+ expect ( router . location ) . toEqual (
92
+ expect . objectContaining ( {
93
+ pathname : '/settings/account/api/applications/234/' ,
94
+ query : { } ,
95
+ } )
96
96
) ;
97
97
} ) ;
98
98
} ) ;
@@ -108,7 +108,7 @@ describe('ApiApplications', () => {
108
108
method : 'DELETE' ,
109
109
} ) ;
110
110
111
- render ( < ApiApplications { ... routerProps } /> ) ;
111
+ render ( < ApiApplications /> ) ;
112
112
renderGlobalModal ( ) ;
113
113
await waitForElementToBeRemoved ( ( ) => screen . queryByTestId ( 'loading-indicator' ) ) ;
114
114
0 commit comments