@@ -128,29 +128,29 @@ function getCachedIterator(pages: Array<{
128128 byPage ( ) : AsyncIterableIterator < any > {
129129 return {
130130 [ Symbol . asyncIterator ] ( ) : AsyncIterableIterator < any > { return this ; } ,
131- next ( ) {
131+ async next ( ) {
132132 const page = pages . shift ( ) ;
133133 if ( ! page ) {
134- return Promise . resolve ( { done : true , value : undefined } ) ;
134+ return { done : true , value : undefined } ;
135135 }
136- const etag = _sha256 ( JSON . stringify ( page . items ) ) ;
136+ const etag = await _sha256 ( JSON . stringify ( page . items ) ) ;
137137
138- return Promise . resolve ( {
138+ return {
139139 done : false ,
140140 value : {
141141 items : page . items ,
142142 etag,
143143 _response : page . response
144144 }
145- } ) ;
145+ } ;
146146 }
147147 } ;
148148 }
149149 } ;
150150 return iterator as any ;
151151}
152152
153- function getMockedHeadIterator ( pages : ConfigurationSetting [ ] [ ] , listOptions : any ) {
153+ function getMockedHeadIterator ( pages : ConfigurationSetting [ ] [ ] , listOptions : any , useStringStatus : boolean = false ) {
154154 const mockIterator : AsyncIterableIterator < any > & { byPage ( ) : AsyncIterableIterator < any > } = {
155155 [ Symbol . asyncIterator ] ( ) : AsyncIterableIterator < any > {
156156 return this ;
@@ -180,7 +180,7 @@ function getMockedHeadIterator(pages: ConfigurationSetting[][], listOptions: any
180180 value : {
181181 items : [ ] , // HEAD request returns no items
182182 etag,
183- _response : { status : statusCode }
183+ _response : { status : useStringStatus ? ` ${ statusCode } ` : statusCode }
184184 }
185185 } ;
186186 }
@@ -229,6 +229,14 @@ function mockAppConfigurationClientListConfigurationSettingsWithStringStatus(pag
229229 const kvs = _filterKVs ( pages . flat ( ) , listOptions ) ;
230230 return getMockedIterator ( pages , kvs , listOptions , true ) ;
231231 } ) ;
232+
233+ sinon . stub ( AppConfigurationClient . prototype , "checkConfigurationSettings" ) . callsFake ( ( listOptions ) => {
234+ if ( customCallback ) {
235+ customCallback ( listOptions ) ;
236+ }
237+
238+ return getMockedHeadIterator ( pages , listOptions , true ) ;
239+ } ) ;
232240}
233241
234242function mockAppConfigurationClientLoadBalanceMode ( pages : ConfigurationSetting [ ] [ ] , clientWrapper : ConfigurationClientWrapper , countObject : { count : number } ) {
0 commit comments