@@ -60,7 +60,7 @@ describe("fromInstanceMetadata", () => {
6060
6161 beforeEach ( ( ) => {
6262 vi . mocked ( staticStabilityProvider ) . mockImplementation ( ( input ) => input ) ;
63- vi . mocked ( getInstanceMetadataEndpoint ) . mockResolvedValue ( { hostname } ) ;
63+ vi . mocked ( getInstanceMetadataEndpoint ) . mockResolvedValue ( { hostname } as any ) ;
6464 ( isImdsCredentials as unknown as any ) . mockReturnValue ( true ) ;
6565 vi . mocked ( providerConfigFromInit ) . mockReturnValue ( {
6666 timeout : mockTimeout ,
@@ -74,9 +74,9 @@ describe("fromInstanceMetadata", () => {
7474
7575 it ( "gets token and profile name to fetch credentials" , async ( ) => {
7676 vi . mocked ( httpRequest )
77- . mockResolvedValueOnce ( mockToken )
78- . mockResolvedValueOnce ( mockProfile )
79- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) ) ;
77+ . mockResolvedValueOnce ( mockToken as any )
78+ . mockResolvedValueOnce ( mockProfile as any )
79+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any ) ;
8080
8181 vi . mocked ( retry ) . mockImplementation ( ( fn : any ) => fn ( ) ) ;
8282 vi . mocked ( fromImdsCredentials ) . mockReturnValue ( mockCreds ) ;
@@ -93,9 +93,9 @@ describe("fromInstanceMetadata", () => {
9393
9494 it ( "trims profile returned name from IMDS" , async ( ) => {
9595 vi . mocked ( httpRequest )
96- . mockResolvedValueOnce ( mockToken )
97- . mockResolvedValueOnce ( " " + mockProfile + " " )
98- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) ) ;
96+ . mockResolvedValueOnce ( mockToken as any )
97+ . mockResolvedValueOnce ( ( " " + mockProfile + " " ) as any )
98+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any ) ;
9999
100100 vi . mocked ( retry ) . mockImplementation ( ( fn : any ) => fn ( ) ) ;
101101 vi . mocked ( fromImdsCredentials ) . mockReturnValue ( mockCreds ) ;
@@ -135,9 +135,9 @@ describe("fromInstanceMetadata", () => {
135135
136136 it ( "throws CredentialsProviderError if credentials returned are incorrect" , async ( ) => {
137137 vi . mocked ( httpRequest )
138- . mockResolvedValueOnce ( mockToken )
139- . mockResolvedValueOnce ( mockProfile )
140- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) ) ;
138+ . mockResolvedValueOnce ( mockToken as any )
139+ . mockResolvedValueOnce ( mockProfile as any )
140+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any ) ;
141141
142142 vi . mocked ( retry ) . mockImplementation ( ( fn : any ) => fn ( ) ) ;
143143 ( isImdsCredentials as unknown as any ) . mockReturnValueOnce ( false ) ;
@@ -154,7 +154,9 @@ describe("fromInstanceMetadata", () => {
154154
155155 it ( "throws Error if httpRequest for profile fails" , async ( ) => {
156156 const mockError = new Error ( "profile not found" ) ;
157- vi . mocked ( httpRequest ) . mockResolvedValueOnce ( mockToken ) . mockRejectedValueOnce ( mockError ) ;
157+ vi . mocked ( httpRequest )
158+ . mockResolvedValueOnce ( mockToken as any )
159+ . mockRejectedValueOnce ( mockError ) ;
158160 vi . mocked ( retry ) . mockImplementation ( ( fn : any ) => fn ( ) ) ;
159161
160162 await expect ( fromInstanceMetadata ( ) ( ) ) . rejects . toEqual ( mockError ) ;
@@ -165,8 +167,8 @@ describe("fromInstanceMetadata", () => {
165167 it ( "throws Error if httpRequest for credentials fails" , async ( ) => {
166168 const mockError = new Error ( "creds not found" ) ;
167169 vi . mocked ( httpRequest )
168- . mockResolvedValueOnce ( mockToken )
169- . mockResolvedValueOnce ( mockProfile )
170+ . mockResolvedValueOnce ( mockToken as any )
171+ . mockResolvedValueOnce ( mockProfile as any )
170172 . mockRejectedValueOnce ( mockError ) ;
171173 vi . mocked ( retry ) . mockImplementation ( ( fn : any ) => fn ( ) ) ;
172174
@@ -178,9 +180,9 @@ describe("fromInstanceMetadata", () => {
178180
179181 it ( "throws SyntaxError if httpRequest returns unparseable creds" , async ( ) => {
180182 vi . mocked ( httpRequest )
181- . mockResolvedValueOnce ( mockToken )
182- . mockResolvedValueOnce ( mockProfile )
183- . mockResolvedValueOnce ( "." ) ;
183+ . mockResolvedValueOnce ( mockToken as any )
184+ . mockResolvedValueOnce ( mockProfile as any )
185+ . mockResolvedValueOnce ( "." as any ) ;
184186 vi . mocked ( retry ) . mockImplementation ( ( fn : any ) => fn ( ) ) ;
185187
186188 await expect ( fromInstanceMetadata ( ) ( ) ) . rejects . toThrow ( "Unexpected token" ) ;
@@ -200,9 +202,9 @@ describe("fromInstanceMetadata", () => {
200202
201203 it ( "should call staticStabilityProvider with the credential loader" , async ( ) => {
202204 vi . mocked ( httpRequest )
203- . mockResolvedValueOnce ( mockToken )
204- . mockResolvedValueOnce ( mockProfile )
205- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) ) ;
205+ . mockResolvedValueOnce ( mockToken as any )
206+ . mockResolvedValueOnce ( mockProfile as any )
207+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any ) ;
206208
207209 vi . mocked ( retry ) . mockImplementation ( ( fn : any ) => fn ( ) ) ;
208210 vi . mocked ( fromImdsCredentials ) . mockReturnValue ( mockCreds ) ;
@@ -222,10 +224,10 @@ describe("fromInstanceMetadata", () => {
222224
223225 vi . mocked ( httpRequest )
224226 . mockRejectedValueOnce ( tokenError )
225- . mockResolvedValueOnce ( mockProfile )
226- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) )
227- . mockResolvedValueOnce ( mockProfile )
228- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) ) ;
227+ . mockResolvedValueOnce ( mockProfile as any )
228+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any )
229+ . mockResolvedValueOnce ( mockProfile as any )
230+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any ) ;
229231
230232 const fromInstanceMetadataFunc = fromInstanceMetadata ( ) ;
231233 await expect ( fromInstanceMetadataFunc ( ) ) . resolves . toEqual ( mockCreds ) ;
@@ -238,10 +240,10 @@ describe("fromInstanceMetadata", () => {
238240
239241 vi . mocked ( httpRequest )
240242 . mockRejectedValueOnce ( tokenError )
241- . mockResolvedValueOnce ( mockProfile )
242- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) )
243- . mockResolvedValueOnce ( mockProfile )
244- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) ) ;
243+ . mockResolvedValueOnce ( mockProfile as any )
244+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any )
245+ . mockResolvedValueOnce ( mockProfile as any )
246+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any ) ;
245247
246248 const fromInstanceMetadataFunc = fromInstanceMetadata ( ) ;
247249 await expect ( fromInstanceMetadataFunc ( ) ) . resolves . toEqual ( mockCreds ) ;
@@ -255,11 +257,11 @@ describe("fromInstanceMetadata", () => {
255257
256258 vi . mocked ( httpRequest )
257259 . mockRejectedValueOnce ( tokenError )
258- . mockResolvedValueOnce ( mockProfile )
259- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) )
260- . mockResolvedValueOnce ( mockToken )
261- . mockResolvedValueOnce ( mockProfile )
262- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) ) ;
260+ . mockResolvedValueOnce ( mockProfile as any )
261+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any )
262+ . mockResolvedValueOnce ( mockToken as any )
263+ . mockResolvedValueOnce ( mockProfile as any )
264+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any ) ;
263265
264266 vi . mocked ( retry ) . mockImplementation ( ( fn : any ) => fn ( ) ) ;
265267 vi . mocked ( fromImdsCredentials ) . mockReturnValue ( mockCreds ) ;
@@ -274,11 +276,11 @@ describe("fromInstanceMetadata", () => {
274276
275277 vi . mocked ( httpRequest )
276278 . mockRejectedValueOnce ( tokenError )
277- . mockResolvedValueOnce ( mockProfile )
278- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) )
279- . mockResolvedValueOnce ( mockToken )
280- . mockResolvedValueOnce ( mockProfile )
281- . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) ) ;
279+ . mockResolvedValueOnce ( mockProfile as any )
280+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any )
281+ . mockResolvedValueOnce ( mockToken as any )
282+ . mockResolvedValueOnce ( mockProfile as any )
283+ . mockResolvedValueOnce ( JSON . stringify ( mockImdsCreds ) as any ) ;
282284
283285 vi . mocked ( retry ) . mockImplementation ( ( fn : any ) => fn ( ) ) ;
284286 vi . mocked ( fromImdsCredentials ) . mockReturnValue ( mockCreds ) ;
0 commit comments