Preserve migration history during config migration
This commit is contained in:
@@ -35,6 +35,31 @@ describe("migrateLegacyConfigFile", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("#given a legacy config sidecar exists", () => {
|
||||
describe("#when migrating the config file", () => {
|
||||
it("#then copies applied migration history to the canonical sidecar", () => {
|
||||
const legacyPath = join(testDir, "oh-my-opencode.json")
|
||||
const legacySidecarPath = `${legacyPath}.migrations.json`
|
||||
const canonicalSidecarPath = join(testDir, "oh-my-openagent.json.migrations.json")
|
||||
writeFileSync(legacyPath, '{ "agents": { "oracle": { "model": "anthropic/claude-opus-4-6" } } }')
|
||||
writeFileSync(
|
||||
legacySidecarPath,
|
||||
JSON.stringify({
|
||||
appliedMigrations: [
|
||||
"model-version:anthropic/claude-opus-4-6->anthropic/claude-opus-4-7",
|
||||
],
|
||||
}),
|
||||
)
|
||||
|
||||
const result = migrateLegacyConfigFile(legacyPath)
|
||||
|
||||
expect(result).toBe(true)
|
||||
expect(existsSync(canonicalSidecarPath)).toBe(true)
|
||||
expect(readFileSync(canonicalSidecarPath, "utf-8")).toBe(readFileSync(legacySidecarPath, "utf-8"))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("#given oh-my-opencode.json exists but oh-my-openagent.json does not", () => {
|
||||
describe("#when migrating the config file", () => {
|
||||
it("#then copies to oh-my-openagent.json", () => {
|
||||
|
||||
Reference in New Issue
Block a user