mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 07:10:55 +00:00
test(cli): make memoryCommand path assertions cross-platform
This commit is contained in:
parent
8a15017593
commit
0a0ab64da0
1 changed files with 7 additions and 9 deletions
|
|
@ -13,9 +13,11 @@ import { MessageType } from '../types.js';
|
|||
import type { LoadedSettings } from '../../config/settings.js';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import {
|
||||
getErrorMessage,
|
||||
loadServerHierarchicalMemory,
|
||||
QWEN_DIR,
|
||||
setGeminiMdFilename,
|
||||
type FileDiscoveryService,
|
||||
type LoadServerHierarchicalMemoryResponse,
|
||||
|
|
@ -133,14 +135,12 @@ describe('memoryCommand', () => {
|
|||
|
||||
await projectCommand.action(mockContext, '');
|
||||
|
||||
expect(mockReadFile).toHaveBeenCalledWith(
|
||||
'/test/project/AGENTS.md',
|
||||
'utf-8',
|
||||
);
|
||||
const expectedProjectPath = path.join('/test/project', 'AGENTS.md');
|
||||
expect(mockReadFile).toHaveBeenCalledWith(expectedProjectPath, 'utf-8');
|
||||
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
|
||||
{
|
||||
type: MessageType.INFO,
|
||||
text: expect.stringContaining('/test/project/AGENTS.md'),
|
||||
text: expect.stringContaining(expectedProjectPath),
|
||||
},
|
||||
expect.any(Number),
|
||||
);
|
||||
|
|
@ -158,10 +158,8 @@ describe('memoryCommand', () => {
|
|||
|
||||
await globalCommand.action(mockContext, '');
|
||||
|
||||
expect(mockReadFile).toHaveBeenCalledWith(
|
||||
'/home/user/.qwen/AGENTS.md',
|
||||
'utf-8',
|
||||
);
|
||||
const expectedGlobalPath = path.join('/home/user', QWEN_DIR, 'AGENTS.md');
|
||||
expect(mockReadFile).toHaveBeenCalledWith(expectedGlobalPath, 'utf-8');
|
||||
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
|
||||
{
|
||||
type: MessageType.INFO,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue