@@ -98,26 +98,30 @@ export default {
9898 ] ,
9999 parameters : {
100100 msw : {
101- handlers : [
102- http . get (
103- 'http://localhost:4466/apis/apps/v1/namespaces/default/statefulsets/mock-statefulset' ,
104- ( ) => {
105- return HttpResponse . json ( mockStatefulSet ) ;
106- }
107- ) ,
108- http . get ( 'http://localhost:4466/api/v1/namespaces/default/pods' , ( ) => {
109- return HttpResponse . json ( {
110- kind : 'PodList' ,
111- items : [ ] ,
112- } ) ;
113- } ) ,
114- http . get ( 'http://localhost:4466/api/v1/namespaces/default/events' , ( ) => {
115- return HttpResponse . json ( {
116- kind : 'EventList' ,
117- items : [ ] ,
118- } ) ;
119- } ) ,
120- ] ,
101+ handlers : {
102+ storyBase : [
103+ http . get ( 'http://localhost:4466/api/v1/namespaces/default/pods' , ( ) => {
104+ return HttpResponse . json ( {
105+ kind : 'PodList' ,
106+ items : [ ] ,
107+ } ) ;
108+ } ) ,
109+ http . get (
110+ 'http://localhost:4466/apis/metrics.k8s.io/v1beta1/namespaces/default/pods' ,
111+ ( ) =>
112+ HttpResponse . json ( {
113+ kind : 'List' ,
114+ items : [ ] ,
115+ } )
116+ ) ,
117+ http . get ( 'http://localhost:4466/api/v1/namespaces/default/events' , ( ) => {
118+ return HttpResponse . json ( {
119+ kind : 'EventList' ,
120+ items : [ ] ,
121+ } ) ;
122+ } ) ,
123+ ] ,
124+ } ,
121125 } ,
122126 } ,
123127} as Meta ;
@@ -129,6 +133,18 @@ Default.args = {
129133 name : 'mock-statefulset' ,
130134 namespace : 'default' ,
131135} ;
136+ Default . parameters = {
137+ msw : {
138+ handlers : {
139+ story : [
140+ http . get (
141+ 'http://localhost:4466/apis/apps/v1/namespaces/default/statefulsets/mock-statefulset' ,
142+ ( ) => HttpResponse . json ( mockStatefulSet )
143+ ) ,
144+ ] ,
145+ } ,
146+ } ,
147+ } ;
132148
133149export const WithOnDeleteStrategy = Template . bind ( { } ) ;
134150WithOnDeleteStrategy . args = {
@@ -137,22 +153,24 @@ WithOnDeleteStrategy.args = {
137153} ;
138154WithOnDeleteStrategy . parameters = {
139155 msw : {
140- handlers : [
141- http . get (
142- 'http://localhost:4466/apis/apps/v1/namespaces/default/statefulsets/mock-statefulset' ,
143- ( ) => {
144- return HttpResponse . json ( {
145- ...mockStatefulSet ,
146- spec : {
147- ...mockStatefulSet . spec ,
148- updateStrategy : {
149- type : 'OnDelete' ,
156+ handlers : {
157+ story : [
158+ http . get (
159+ 'http://localhost:4466/apis/apps/v1/namespaces/default/statefulsets/mock-statefulset' ,
160+ ( ) => {
161+ return HttpResponse . json ( {
162+ ...mockStatefulSet ,
163+ spec : {
164+ ...mockStatefulSet . spec ,
165+ updateStrategy : {
166+ type : 'OnDelete' ,
167+ } ,
150168 } ,
151- } ,
152- } ) ;
153- }
154- ) ,
155- ] ,
169+ } ) ;
170+ }
171+ ) ,
172+ ] ,
173+ } ,
156174 } ,
157175} ;
158176
@@ -163,26 +181,28 @@ WithComplexSelector.args = {
163181} ;
164182WithComplexSelector . parameters = {
165183 msw : {
166- handlers : [
167- http . get (
168- 'http://localhost:4466/apis/apps/v1/namespaces/default/statefulsets/mock-statefulset' ,
169- ( ) => {
170- return HttpResponse . json ( {
171- ...mockStatefulSet ,
172- spec : {
173- ...mockStatefulSet . spec ,
174- selector : {
175- matchLabels : {
176- app : 'mock-app' ,
177- tier : 'backend' ,
178- environment : 'production' ,
184+ handlers : {
185+ story : [
186+ http . get (
187+ 'http://localhost:4466/apis/apps/v1/namespaces/default/statefulsets/mock-statefulset' ,
188+ ( ) => {
189+ return HttpResponse . json ( {
190+ ...mockStatefulSet ,
191+ spec : {
192+ ...mockStatefulSet . spec ,
193+ selector : {
194+ matchLabels : {
195+ app : 'mock-app' ,
196+ tier : 'backend' ,
197+ environment : 'production' ,
198+ } ,
179199 } ,
180200 } ,
181- } ,
182- } ) ;
183- }
184- ) ,
185- ] ,
201+ } ) ;
202+ }
203+ ) ,
204+ ] ,
205+ } ,
186206 } ,
187207} ;
188208
@@ -193,33 +213,35 @@ WithMultipleContainers.args = {
193213} ;
194214WithMultipleContainers . parameters = {
195215 msw : {
196- handlers : [
197- http . get (
198- 'http://localhost:4466/apis/apps/v1/namespaces/default/statefulsets/mock-statefulset' ,
199- ( ) => {
200- return HttpResponse . json ( {
201- ...mockStatefulSet ,
202- spec : {
203- ...mockStatefulSet . spec ,
204- template : {
205- ...mockStatefulSet . spec . template ,
206- spec : {
207- containers : [
208- {
209- name : 'main' ,
210- image : 'mock-image:latest' ,
211- } ,
212- {
213- name : 'sidecar' ,
214- image : 'sidecar-image:latest' ,
215- } ,
216- ] ,
216+ handlers : {
217+ story : [
218+ http . get (
219+ 'http://localhost:4466/apis/apps/v1/namespaces/default/statefulsets/mock-statefulset' ,
220+ ( ) => {
221+ return HttpResponse . json ( {
222+ ...mockStatefulSet ,
223+ spec : {
224+ ...mockStatefulSet . spec ,
225+ template : {
226+ ...mockStatefulSet . spec . template ,
227+ spec : {
228+ containers : [
229+ {
230+ name : 'main' ,
231+ image : 'mock-image:latest' ,
232+ } ,
233+ {
234+ name : 'sidecar' ,
235+ image : 'sidecar-image:latest' ,
236+ } ,
237+ ] ,
238+ } ,
217239 } ,
218240 } ,
219- } ,
220- } ) ;
221- }
222- ) ,
223- ] ,
241+ } ) ;
242+ }
243+ ) ,
244+ ] ,
245+ } ,
224246 } ,
225247} ;
0 commit comments