@@ -2,6 +2,7 @@ import * as fs from 'fs';
22import * as fsPromises from 'fs/promises' ;
33import * as path from 'path' ;
44
5+ import { MockLogger } from 'mycoder-agent' ;
56import { describe , it , expect , vi , beforeEach , afterEach } from 'vitest' ;
67
78import {
@@ -23,9 +24,6 @@ import { getSettingsDir } from '../settings/settings.js';
2324vi . mock ( 'fs' ) ;
2425vi . mock ( 'fs/promises' ) ;
2526vi . mock ( 'mycoder-agent' , ( ) => ( {
26- Logger : vi . fn ( ) . mockImplementation ( ( ) => ( {
27- warn : vi . fn ( ) ,
28- } ) ) ,
2927 errorToString : vi . fn ( ) ,
3028} ) ) ;
3129
@@ -139,7 +137,7 @@ describe('versionCheck', () => {
139137 json : ( ) => Promise . resolve ( { version : '2.0.0' } ) ,
140138 } ) ;
141139
142- const result = await checkForUpdates ( ) ;
140+ const result = await checkForUpdates ( new MockLogger ( ) ) ;
143141 expect ( result ) . toBe ( null ) ;
144142
145143 // Wait for setImmediate to complete
@@ -161,7 +159,7 @@ describe('versionCheck', () => {
161159 fsPromises . readFile as unknown as ReturnType < typeof vi . fn >
162160 ) . mockResolvedValue ( '2.0.0' ) ;
163161
164- const result = await checkForUpdates ( ) ;
162+ const result = await checkForUpdates ( new MockLogger ( ) ) ;
165163 expect ( result ) . toContain ( 'Update available' ) ;
166164 } ) ;
167165
@@ -173,7 +171,7 @@ describe('versionCheck', () => {
173171 fsPromises . readFile as unknown as ReturnType < typeof vi . fn >
174172 ) . mockRejectedValue ( new Error ( 'Test error' ) ) ;
175173
176- const result = await checkForUpdates ( ) ;
174+ const result = await checkForUpdates ( new MockLogger ( ) ) ;
177175 expect ( result ) . toBe ( null ) ;
178176 } ) ;
179177
@@ -183,7 +181,7 @@ describe('versionCheck', () => {
183181 ) ;
184182 mockFetch . mockRejectedValue ( new Error ( 'Network error' ) ) ;
185183
186- const result = await checkForUpdates ( ) ;
184+ const result = await checkForUpdates ( new MockLogger ( ) ) ;
187185 expect ( result ) . toBe ( null ) ;
188186
189187 // Wait for setImmediate to complete
0 commit comments