@@ -49,7 +49,10 @@ describe('useBootstrapOrganizationQuery', () => {
4949 query : { detailed : 0 , include_feature_flags : 1 } ,
5050 } ) ;
5151
52- const { result} = renderHook ( ( ) => useBootstrapOrganizationQuery ( orgSlug ) , { wrapper} ) ;
52+ const { result} = renderHook ( useBootstrapOrganizationQuery , {
53+ wrapper,
54+ initialProps : orgSlug ,
55+ } ) ;
5356
5457 await waitFor ( ( ) => expect ( result . current . data ) . toBeDefined ( ) ) ;
5558 expect ( JSON . stringify ( OrganizationStore . get ( ) . organization ) ) . toEqual (
@@ -64,7 +67,10 @@ describe('useBootstrapOrganizationQuery', () => {
6467 body : { } ,
6568 } ) ;
6669
67- const { result} = renderHook ( ( ) => useBootstrapOrganizationQuery ( orgSlug ) , { wrapper} ) ;
70+ const { result} = renderHook ( useBootstrapOrganizationQuery , {
71+ wrapper,
72+ initialProps : orgSlug ,
73+ } ) ;
6874
6975 await waitFor ( ( ) => expect ( result . current . error ) . toBeDefined ( ) ) ;
7076 expect ( OrganizationStore . get ( ) . organization ) . toBeNull ( ) ;
@@ -75,7 +81,10 @@ describe('useBootstrapOrganizationQuery', () => {
7581 } ) ;
7682
7783 it ( 'does not fetch when orgSlug is null' , ( ) => {
78- const { result} = renderHook ( ( ) => useBootstrapOrganizationQuery ( null ) , { wrapper} ) ;
84+ const { result} = renderHook ( useBootstrapOrganizationQuery , {
85+ wrapper,
86+ initialProps : null ,
87+ } ) ;
7988 expect ( result . current . data ) . toBeUndefined ( ) ;
8089 } ) ;
8190
@@ -84,7 +93,10 @@ describe('useBootstrapOrganizationQuery', () => {
8493 orgSlug : org . slug ,
8594 organization : Promise . resolve < ApiResult < Organization > > ( [ org , undefined , undefined ] ) ,
8695 } ;
87- const { result} = renderHook ( ( ) => useBootstrapOrganizationQuery ( orgSlug ) , { wrapper} ) ;
96+ const { result} = renderHook ( useBootstrapOrganizationQuery , {
97+ wrapper,
98+ initialProps : orgSlug ,
99+ } ) ;
88100 await waitFor ( ( ) => expect ( result . current . data ) . toBeDefined ( ) ) ;
89101 expect ( window . __sentry_preload ?. organization ) . toBeUndefined ( ) ;
90102 } ) ;
@@ -105,7 +117,10 @@ describe('useBootstrapOrganizationQuery', () => {
105117 query : { detailed : 0 , include_feature_flags : 1 } ,
106118 } ) ;
107119
108- const { result} = renderHook ( ( ) => useBootstrapOrganizationQuery ( orgSlug ) , { wrapper} ) ;
120+ const { result} = renderHook ( useBootstrapOrganizationQuery , {
121+ wrapper,
122+ initialProps : orgSlug ,
123+ } ) ;
109124 await waitFor ( ( ) => expect ( result . current . data ) . toBeDefined ( ) ) ;
110125 expect ( JSON . stringify ( OrganizationStore . get ( ) . organization ?. features ) ) . toEqual (
111126 JSON . stringify ( [ 'enable-issues' ] )
@@ -141,7 +156,7 @@ describe('useBootstrapTeamsQuery', () => {
141156 } ,
142157 } ) ;
143158
144- const { result} = renderHook ( ( ) => useBootstrapTeamsQuery ( orgSlug ) , { wrapper} ) ;
159+ const { result} = renderHook ( useBootstrapTeamsQuery , { wrapper, initialProps : orgSlug } ) ;
145160
146161 await waitFor ( ( ) => expect ( result . current . data ) . toBeDefined ( ) ) ;
147162 expect ( TeamStore . getState ( ) . teams ) . toEqual ( mockTeams ) ;
@@ -154,14 +169,14 @@ describe('useBootstrapTeamsQuery', () => {
154169 statusCode : 500 ,
155170 } ) ;
156171
157- const { result} = renderHook ( ( ) => useBootstrapTeamsQuery ( orgSlug ) , { wrapper} ) ;
172+ const { result} = renderHook ( useBootstrapTeamsQuery , { wrapper, initialProps : orgSlug } ) ;
158173
159174 await waitFor ( ( ) => expect ( result . current . error ) . toBeDefined ( ) ) ;
160175 expect ( TeamStore . getState ( ) . teams ) . toEqual ( [ ] ) ;
161176 } ) ;
162177
163178 it ( 'does not fetch when orgSlug is null' , ( ) => {
164- const { result} = renderHook ( ( ) => useBootstrapTeamsQuery ( null ) , { wrapper} ) ;
179+ const { result} = renderHook ( useBootstrapTeamsQuery , { wrapper, initialProps : null } ) ;
165180 expect ( result . current . data ) . toBeUndefined ( ) ;
166181 } ) ;
167182} ) ;
@@ -186,7 +201,10 @@ describe('useBootstrapProjectsQuery', () => {
186201 } ,
187202 } ) ;
188203
189- const { result} = renderHook ( ( ) => useBootstrapProjectsQuery ( orgSlug ) , { wrapper} ) ;
204+ const { result} = renderHook ( useBootstrapProjectsQuery , {
205+ wrapper,
206+ initialProps : orgSlug ,
207+ } ) ;
190208
191209 await waitFor ( ( ) => expect ( result . current . data ) . toBeDefined ( ) ) ;
192210 expect ( ProjectsStore . getState ( ) . projects ) . toEqual ( mockProjects ) ;
@@ -198,14 +216,17 @@ describe('useBootstrapProjectsQuery', () => {
198216 statusCode : 500 ,
199217 } ) ;
200218
201- const { result} = renderHook ( ( ) => useBootstrapProjectsQuery ( orgSlug ) , { wrapper} ) ;
219+ const { result} = renderHook ( useBootstrapProjectsQuery , {
220+ wrapper,
221+ initialProps : orgSlug ,
222+ } ) ;
202223
203224 await waitFor ( ( ) => expect ( result . current . error ) . toBeDefined ( ) ) ;
204225 expect ( ProjectsStore . getState ( ) . projects ) . toEqual ( [ ] ) ;
205226 } ) ;
206227
207228 it ( 'does not fetch when orgSlug is null' , ( ) => {
208- const { result} = renderHook ( ( ) => useBootstrapProjectsQuery ( null ) , { wrapper} ) ;
229+ const { result} = renderHook ( useBootstrapProjectsQuery , { wrapper, initialProps : null } ) ;
209230 expect ( result . current . data ) . toBeUndefined ( ) ;
210231 } ) ;
211232} ) ;
0 commit comments