chore(cleanup): remove system-check skills
Remove check_system_memory, check_storage, check_battery_and_cpu and check_internet_connection along with their windows/ implementation and the empty mac/ placeholder. These general-purpose system-check skills have no place in Max's exclusive freelance-coach pipeline, which now runs server-side in Max API. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
bae5ace70c
commit
7c480e1ce4
@@ -1,29 +0,0 @@
|
||||
import { describe, it, expect, vi, afterEach } from 'vitest'
|
||||
|
||||
describe('systemPaths', () => {
|
||||
const originalSystemRoot = process.env.SystemRoot
|
||||
const originalWindir = process.env.windir
|
||||
|
||||
afterEach(() => {
|
||||
if (originalSystemRoot === undefined) delete process.env.SystemRoot
|
||||
else process.env.SystemRoot = originalSystemRoot
|
||||
if (originalWindir === undefined) delete process.env.windir
|
||||
else process.env.windir = originalWindir
|
||||
vi.resetModules()
|
||||
})
|
||||
|
||||
it('should fall back to C:\\Windows when neither SystemRoot nor windir is set', async () => {
|
||||
delete process.env.SystemRoot
|
||||
delete process.env.windir
|
||||
vi.resetModules()
|
||||
const { POWERSHELL_EXE } = await import('../../src/main/skills/windows/lib/systemPaths')
|
||||
expect(POWERSHELL_EXE).toContain('C:\\Windows')
|
||||
})
|
||||
|
||||
it('should use SystemRoot when set', async () => {
|
||||
process.env.SystemRoot = 'D:\\CustomWindows'
|
||||
vi.resetModules()
|
||||
const { POWERSHELL_EXE } = await import('../../src/main/skills/windows/lib/systemPaths')
|
||||
expect(POWERSHELL_EXE).toContain('D:\\CustomWindows')
|
||||
})
|
||||
})
|
||||
@@ -1,15 +0,0 @@
|
||||
import { describe, it, expect, vi } from 'vitest'
|
||||
|
||||
vi.mock('os', () => ({
|
||||
totalmem: () => 16 * 1024 ** 3,
|
||||
freemem: () => 4 * 1024 ** 3
|
||||
}))
|
||||
|
||||
const { systemMemory } = await import('../../src/main/skills/windows/systemMemory')
|
||||
|
||||
describe('check_system_memory', () => {
|
||||
it('should report used/total/free memory in GB computed from os.totalmem/freemem', async () => {
|
||||
const result = await systemMemory.execute({})
|
||||
expect(result).toBe('Memoire RAM : 12.0 Go utilises sur 16.0 Go (4.0 Go libres).')
|
||||
})
|
||||
})
|
||||
@@ -1,85 +0,0 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
|
||||
const execFileMock = vi.fn(
|
||||
(
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
_opts: unknown,
|
||||
cb?: (err: Error | null, result: unknown) => void
|
||||
) => {
|
||||
const callback = typeof _opts === 'function' ? (_opts as typeof cb) : cb
|
||||
callback?.(null, { stdout: '{}', stderr: '' })
|
||||
}
|
||||
)
|
||||
vi.mock('child_process', () => ({ execFile: execFileMock }))
|
||||
|
||||
const { systemStatus } = await import('../../src/main/skills/windows/systemStatus')
|
||||
const { systemStorage } = await import('../../src/main/skills/windows/systemStorage')
|
||||
const { checkInternet } = await import('../../src/main/skills/windows/checkInternet')
|
||||
|
||||
function mockStdout(json: unknown): void {
|
||||
execFileMock.mockImplementation(
|
||||
(
|
||||
_cmd: string,
|
||||
_args: string[],
|
||||
optsOrCb: unknown,
|
||||
cb?: (err: Error | null, result: unknown) => void
|
||||
) => {
|
||||
const callback = typeof optsOrCb === 'function' ? (optsOrCb as typeof cb) : cb
|
||||
callback?.(null, { stdout: JSON.stringify(json), stderr: '' })
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
describe('check_battery_and_cpu', () => {
|
||||
it('should report no battery for a desktop computer', async () => {
|
||||
mockStdout({ BatteryPercent: null, Charging: null, CpuPercent: 42 })
|
||||
const result = await systemStatus.execute({})
|
||||
expect(result).toMatch(/Pas de batterie detectee/)
|
||||
expect(result).toMatch(/42%/)
|
||||
})
|
||||
|
||||
it('should report battery level and charging state for a laptop', async () => {
|
||||
mockStdout({ BatteryPercent: 80, Charging: true, CpuPercent: 10 })
|
||||
const result = await systemStatus.execute({})
|
||||
expect(result).toMatch(/Batterie a 80%/)
|
||||
expect(result).toMatch(/en charge/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('check_storage', () => {
|
||||
it('should report usage for a single drive', async () => {
|
||||
mockStdout({ DriveLetter: 'C', SizeGB: 500, FreeGB: 100 })
|
||||
const result = await systemStorage.execute({})
|
||||
expect(result).toMatch(/Disque C : 400\.0 Go utilises sur 500 Go \(100 Go libres\)/)
|
||||
})
|
||||
|
||||
it('should report usage for multiple drives', async () => {
|
||||
mockStdout([
|
||||
{ DriveLetter: 'C', SizeGB: 500, FreeGB: 100 },
|
||||
{ DriveLetter: 'D', SizeGB: 1000, FreeGB: 900 }
|
||||
])
|
||||
const result = await systemStorage.execute({})
|
||||
expect(result).toMatch(/Disque C/)
|
||||
expect(result).toMatch(/Disque D/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('check_internet_connection', () => {
|
||||
it('should report a working connection with its local IP', async () => {
|
||||
mockStdout({ Connected: true, Ip: '192.168.1.10' })
|
||||
const result = await checkInternet.execute({})
|
||||
expect(result).toMatch(/Internet fonctionne/)
|
||||
expect(result).toMatch(/192\.168\.1\.10/)
|
||||
})
|
||||
|
||||
it('should report no connection', async () => {
|
||||
mockStdout({ Connected: false, Ip: null })
|
||||
const result = await checkInternet.execute({})
|
||||
expect(result).toMatch(/Pas de connexion internet/)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user