mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
Bump settings version to V3 even when no migration changes needed
This commit is contained in:
parent
2c25b2fabd
commit
895cbf71cd
2 changed files with 36 additions and 0 deletions
|
|
@ -712,6 +712,36 @@ describe('Settings Loading and Merging', () => {
|
|||
expect(settings.merged.general?.enableAutoUpdate).toBe(false);
|
||||
});
|
||||
|
||||
it('should bump version to 3 even when V2 settings already have V3-compatible content', () => {
|
||||
(mockFsExistsSync as Mock).mockImplementation(
|
||||
(p: fs.PathLike) => p === USER_SETTINGS_PATH,
|
||||
);
|
||||
// V2 settings that already have V3-compatible keys (no migration needed)
|
||||
const v2SettingsWithV3Content = {
|
||||
$version: 2,
|
||||
general: {
|
||||
enableAutoUpdate: true,
|
||||
},
|
||||
};
|
||||
(fs.readFileSync as Mock).mockImplementation(
|
||||
(p: fs.PathOrFileDescriptor) => {
|
||||
if (p === USER_SETTINGS_PATH)
|
||||
return JSON.stringify(v2SettingsWithV3Content);
|
||||
return '{}';
|
||||
},
|
||||
);
|
||||
|
||||
loadSettings(MOCK_WORKSPACE_DIR);
|
||||
|
||||
// Version should be bumped to 3 even though no keys needed migration
|
||||
const writeCall = (fs.writeFileSync as Mock).mock.calls.find(
|
||||
(call: unknown[]) => call[0] === USER_SETTINGS_PATH,
|
||||
);
|
||||
expect(writeCall).toBeDefined();
|
||||
const writtenContent = JSON.parse(writeCall[1] as string);
|
||||
expect(writtenContent.$version).toBe(SETTINGS_VERSION);
|
||||
});
|
||||
|
||||
it('should correctly merge and migrate legacy array properties from multiple scopes', () => {
|
||||
(mockFsExistsSync as Mock).mockReturnValue(true);
|
||||
const legacyUserSettings = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue