@@ -218,10 +218,9 @@ describe('getContexts', () => {
218
218
} as fs . Dirent ,
219
219
] ) ;
220
220
221
- vi . spyOn ( fs . promises , 'readFile' ) . mockResolvedValueOnce ( 'invalid JSON' ) ;
222
- vi . spyOn ( fs . promises , 'readFile' ) . mockResolvedValueOnce (
223
- JSON . stringify ( { Name : 'bar' , Endpoints : { docker : { Host : 'foo' } } } ) ,
224
- ) ;
221
+ const spyReadFile = vi . spyOn ( fs . promises , 'readFile' ) ;
222
+ spyReadFile . mockResolvedValueOnce ( 'invalid JSON' ) ;
223
+ spyReadFile . mockResolvedValueOnce ( JSON . stringify ( { Name : 'bar' , Endpoints : { docker : { Host : 'foo' } } } ) ) ;
225
224
226
225
const contexts = await dockerContextHandler . getContexts ( ) ;
227
226
@@ -247,8 +246,9 @@ describe('getContexts', () => {
247
246
} as fs . Dirent ,
248
247
] ) ;
249
248
250
- vi . spyOn ( fs . promises , 'readFile' ) . mockResolvedValueOnce ( JSON . stringify ( { Name : 'foo' } ) ) ;
251
- vi . spyOn ( fs . promises , 'readFile' ) . mockResolvedValueOnce ( JSON . stringify ( { Name : 'bar' } ) ) ;
249
+ const spyReadFile = vi . spyOn ( fs . promises , 'readFile' ) ;
250
+ spyReadFile . mockResolvedValueOnce ( JSON . stringify ( { Name : 'foo' } ) ) ;
251
+ spyReadFile . mockResolvedValueOnce ( JSON . stringify ( { Name : 'bar' } ) ) ;
252
252
253
253
const contexts = await dockerContextHandler . getContexts ( ) ;
254
254
@@ -269,9 +269,10 @@ describe('getContexts', () => {
269
269
name : 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9' ,
270
270
} as fs . Dirent ,
271
271
] ) ;
272
+ const spyReadFile = vi . spyOn ( fs . promises , 'readFile' ) ;
272
273
273
- vi . spyOn ( fs . promises , 'readFile' ) . mockResolvedValueOnce ( JSON . stringify ( { Name : 'foo' } ) ) ;
274
- vi . spyOn ( fs . promises , 'readFile' ) . mockResolvedValueOnce ( JSON . stringify ( { Name : 'bar' } ) ) ;
274
+ spyReadFile . mockResolvedValueOnce ( JSON . stringify ( { Name : 'foo' } ) ) ;
275
+ spyReadFile . mockResolvedValueOnce ( JSON . stringify ( { Name : 'bar' } ) ) ;
275
276
276
277
const contexts = await dockerContextHandler . getContexts ( ) ;
277
278
0 commit comments