mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
fix: update tests for new model resolver passthrough behavior
1. model-resolver tests:
- Unknown models now pass through unchanged (provider model support)
- Removed expectations for warnings on unknown models
- Updated case sensitivity and edge case tests accordingly
- Added tests for provider-like model names (GLM-4.7, MiniMax-M2.1)
2. atomic-writer tests:
- Updated regex to match new temp file format with random suffix
- Format changed from .tmp.{timestamp} to .tmp.{timestamp}.{hex}
This commit is contained in:
@@ -64,16 +64,17 @@ describe('atomic-writer.ts', () => {
|
||||
await atomicWriteJson(filePath, data);
|
||||
|
||||
// Verify writeFile was called with temp file path and JSON content
|
||||
// Format: .tmp.{timestamp}.{random-hex}
|
||||
expect(secureFs.writeFile).toHaveBeenCalledTimes(1);
|
||||
const writeCall = (secureFs.writeFile as unknown as MockInstance).mock.calls[0];
|
||||
expect(writeCall[0]).toMatch(/\.tmp\.\d+$/);
|
||||
expect(writeCall[0]).toMatch(/\.tmp\.\d+\.[a-f0-9]+$/);
|
||||
expect(writeCall[1]).toBe(JSON.stringify(data, null, 2));
|
||||
expect(writeCall[2]).toBe('utf-8');
|
||||
|
||||
// Verify rename was called with temp -> target
|
||||
expect(secureFs.rename).toHaveBeenCalledTimes(1);
|
||||
const renameCall = (secureFs.rename as unknown as MockInstance).mock.calls[0];
|
||||
expect(renameCall[0]).toMatch(/\.tmp\.\d+$/);
|
||||
expect(renameCall[0]).toMatch(/\.tmp\.\d+\.[a-f0-9]+$/);
|
||||
expect(renameCall[1]).toBe(path.resolve(filePath));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user