1
+ import { LocationFixture } from 'sentry-fixture/locationFixture' ;
1
2
import { OrganizationFixture } from 'sentry-fixture/organization' ;
3
+ import { RouterFixture } from 'sentry-fixture/routerFixture' ;
2
4
import { SentryAppFixture } from 'sentry-fixture/sentryApp' ;
3
5
4
6
import { initializeOrg } from 'sentry-test/initializeOrg' ;
@@ -14,7 +16,7 @@ import {
14
16
import OrganizationDeveloperSettings from 'sentry/views/settings/organizationDeveloperSettings/index' ;
15
17
16
18
describe ( 'Organization Developer Settings' , function ( ) {
17
- const { organization : org , routerProps , router } = initializeOrg ( ) ;
19
+ const { organization : org } = initializeOrg ( ) ;
18
20
const sentryApp = SentryAppFixture ( {
19
21
scopes : [
20
22
'team:read' ,
@@ -36,7 +38,7 @@ describe('Organization Developer Settings', function () {
36
38
url : `/organizations/${ org . slug } /sentry-apps/` ,
37
39
body : [ ] ,
38
40
} ) ;
39
- render ( < OrganizationDeveloperSettings { ... routerProps } organization = { org } /> ) ;
41
+ render ( < OrganizationDeveloperSettings /> ) ;
40
42
await waitFor ( ( ) => {
41
43
expect (
42
44
screen . getByText ( 'No internal integrations have been created yet.' )
@@ -53,25 +55,21 @@ describe('Organization Developer Settings', function () {
53
55
} ) ;
54
56
} ) ;
55
57
56
- it ( 'internal integrations list is empty' , ( ) => {
57
- render ( < OrganizationDeveloperSettings { ...routerProps } organization = { org } /> , {
58
- organization : org ,
59
- } ) ;
58
+ it ( 'internal integrations list is empty' , async ( ) => {
59
+ render ( < OrganizationDeveloperSettings /> ) ;
60
60
expect (
61
- screen . getByText ( 'No internal integrations have been created yet.' )
61
+ await screen . findByText ( 'No internal integrations have been created yet.' )
62
62
) . toBeInTheDocument ( ) ;
63
63
} ) ;
64
64
65
- it ( 'public integrations list contains 1 item' , ( ) => {
66
- render (
67
- < OrganizationDeveloperSettings
68
- { ...routerProps }
69
- organization = { org }
70
- location = { { ...router . location , query : { type : 'public' } } }
71
- /> ,
72
- { organization : org }
73
- ) ;
74
- expect ( screen . getByText ( 'Sample App' ) ) . toBeInTheDocument ( ) ;
65
+ it ( 'public integrations list contains 1 item' , async ( ) => {
66
+ const router = RouterFixture ( {
67
+ location : LocationFixture ( { query : { type : 'public' } } ) ,
68
+ } ) ;
69
+ render ( < OrganizationDeveloperSettings /> , {
70
+ router,
71
+ } ) ;
72
+ expect ( await screen . findByText ( 'Sample App' ) ) . toBeInTheDocument ( ) ;
75
73
expect ( screen . getByText ( 'unpublished' ) ) . toBeInTheDocument ( ) ;
76
74
} ) ;
77
75
@@ -81,13 +79,12 @@ describe('Organization Developer Settings', function () {
81
79
method : 'DELETE' ,
82
80
body : [ ] ,
83
81
} ) ;
84
- render (
85
- < OrganizationDeveloperSettings
86
- { ...routerProps }
87
- organization = { org }
88
- location = { { ...router . location , query : { type : 'public' } } }
89
- />
90
- ) ;
82
+ const router = RouterFixture ( {
83
+ location : LocationFixture ( { query : { type : 'public' } } ) ,
84
+ } ) ;
85
+ render ( < OrganizationDeveloperSettings /> , {
86
+ router,
87
+ } ) ;
91
88
92
89
const deleteButton = await screen . findByRole ( 'button' , { name : 'Delete' } ) ;
93
90
expect ( deleteButton ) . toHaveAttribute ( 'aria-disabled' , 'false' ) ;
@@ -111,14 +108,13 @@ describe('Organization Developer Settings', function () {
111
108
url : `/sentry-apps/${ sentryApp . slug } /publish-request/` ,
112
109
method : 'POST' ,
113
110
} ) ;
111
+ const router = RouterFixture ( {
112
+ location : LocationFixture ( { query : { type : 'public' } } ) ,
113
+ } ) ;
114
114
115
- render (
116
- < OrganizationDeveloperSettings
117
- { ...routerProps }
118
- organization = { org }
119
- location = { { ...router . location , query : { type : 'public' } } }
120
- />
121
- ) ;
115
+ render ( < OrganizationDeveloperSettings /> , {
116
+ router,
117
+ } ) ;
122
118
123
119
const publishButton = await screen . findByRole ( 'button' , { name : 'Publish' } ) ;
124
120
@@ -173,37 +169,34 @@ describe('Organization Developer Settings', function () {
173
169
body : [ publishedSentryApp ] ,
174
170
} ) ;
175
171
} ) ;
176
- it ( 'shows the published status' , ( ) => {
177
- render (
178
- < OrganizationDeveloperSettings
179
- { ...routerProps }
180
- organization = { org }
181
- location = { { ...router . location , query : { type : 'public' } } }
182
- />
183
- ) ;
184
- expect ( screen . getByText ( 'published' ) ) . toBeInTheDocument ( ) ;
172
+ it ( 'shows the published status' , async ( ) => {
173
+ const router = RouterFixture ( {
174
+ location : LocationFixture ( { query : { type : 'public' } } ) ,
175
+ } ) ;
176
+ render ( < OrganizationDeveloperSettings /> , {
177
+ router,
178
+ } ) ;
179
+ expect ( await screen . findByText ( 'published' ) ) . toBeInTheDocument ( ) ;
185
180
} ) ;
186
181
187
182
it ( 'trash button is disabled' , async ( ) => {
188
- render (
189
- < OrganizationDeveloperSettings
190
- { ...routerProps }
191
- organization = { org }
192
- location = { { ...router . location , query : { type : 'public' } } }
193
- />
194
- ) ;
183
+ const router = RouterFixture ( {
184
+ location : LocationFixture ( { query : { type : 'public' } } ) ,
185
+ } ) ;
186
+ render ( < OrganizationDeveloperSettings /> , {
187
+ router,
188
+ } ) ;
195
189
const deleteButton = await screen . findByRole ( 'button' , { name : 'Delete' } ) ;
196
190
expect ( deleteButton ) . toHaveAttribute ( 'aria-disabled' , 'true' ) ;
197
191
} ) ;
198
192
199
193
it ( 'publish button is disabled' , async ( ) => {
200
- render (
201
- < OrganizationDeveloperSettings
202
- { ...routerProps }
203
- organization = { org }
204
- location = { { ...router . location , query : { type : 'public' } } }
205
- />
206
- ) ;
194
+ const router = RouterFixture ( {
195
+ location : LocationFixture ( { query : { type : 'public' } } ) ,
196
+ } ) ;
197
+ render ( < OrganizationDeveloperSettings /> , {
198
+ router,
199
+ } ) ;
207
200
const publishButton = await screen . findByRole ( 'button' , { name : 'Publish' } ) ;
208
201
expect ( publishButton ) . toHaveAttribute ( 'aria-disabled' , 'true' ) ;
209
202
} ) ;
@@ -220,13 +213,13 @@ describe('Organization Developer Settings', function () {
220
213
} ) ;
221
214
222
215
it ( 'allows deleting' , async ( ) => {
223
- render ( < OrganizationDeveloperSettings { ... routerProps } organization = { org } /> ) ;
216
+ render ( < OrganizationDeveloperSettings /> ) ;
224
217
const deleteButton = await screen . findByRole ( 'button' , { name : 'Delete' } ) ;
225
218
expect ( deleteButton ) . toHaveAttribute ( 'aria-disabled' , 'false' ) ;
226
219
} ) ;
227
220
228
221
it ( 'publish button does not exist' , ( ) => {
229
- render ( < OrganizationDeveloperSettings { ... routerProps } organization = { org } /> ) ;
222
+ render ( < OrganizationDeveloperSettings /> ) ;
230
223
expect ( screen . queryByText ( 'Publish' ) ) . not . toBeInTheDocument ( ) ;
231
224
} ) ;
232
225
} ) ;
@@ -240,27 +233,25 @@ describe('Organization Developer Settings', function () {
240
233
} ) ;
241
234
} ) ;
242
235
it ( 'trash button is disabled' , async ( ) => {
243
- render (
244
- < OrganizationDeveloperSettings
245
- { ...routerProps }
246
- organization = { newOrg }
247
- location = { { ...router . location , query : { type : 'public' } } }
248
- /> ,
249
- { organization : newOrg }
250
- ) ;
236
+ const router = RouterFixture ( {
237
+ location : LocationFixture ( { query : { type : 'public' } } ) ,
238
+ } ) ;
239
+ render ( < OrganizationDeveloperSettings /> , {
240
+ router,
241
+ organization : newOrg ,
242
+ } ) ;
251
243
const deleteButton = await screen . findByRole ( 'button' , { name : 'Delete' } ) ;
252
244
expect ( deleteButton ) . toHaveAttribute ( 'aria-disabled' , 'true' ) ;
253
245
} ) ;
254
246
255
247
it ( 'publish button is disabled' , async ( ) => {
256
- render (
257
- < OrganizationDeveloperSettings
258
- { ...routerProps }
259
- organization = { newOrg }
260
- location = { { ...router . location , query : { type : 'public' } } }
261
- /> ,
262
- { organization : newOrg }
263
- ) ;
248
+ const router = RouterFixture ( {
249
+ location : LocationFixture ( { query : { type : 'public' } } ) ,
250
+ } ) ;
251
+ render ( < OrganizationDeveloperSettings /> , {
252
+ organization : newOrg ,
253
+ router,
254
+ } ) ;
264
255
const publishButton = await screen . findByRole ( 'button' , { name : 'Publish' } ) ;
265
256
expect ( publishButton ) . toHaveAttribute ( 'aria-disabled' , 'true' ) ;
266
257
} ) ;
0 commit comments