mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-30 17:14:40 +08:00
test(cli): cover json permission migration
This commit is contained in:
committed by
Catriel Müller
parent
ab1c90b68c
commit
941007b68d
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"kilo-code": patch
|
||||
---
|
||||
|
||||
Handle string-form permission values when migrating bash permissions.
|
||||
@@ -403,6 +403,37 @@ test("migrates string-form global permission in jsonc without throwing", async (
|
||||
}
|
||||
})
|
||||
|
||||
test("migrates string-form global permission in json without throwing", async () => {
|
||||
await using globalTmp = await tmpdir({
|
||||
init: async (dir) => {
|
||||
await Filesystem.write(
|
||||
path.join(dir, "kilo.json"),
|
||||
JSON.stringify({
|
||||
$schema: "https://app.kilo.ai/config.json",
|
||||
permission: "allow",
|
||||
}),
|
||||
)
|
||||
},
|
||||
})
|
||||
|
||||
const prev = Global.Path.config
|
||||
;(Global.Path as { config: string }).config = globalTmp.path
|
||||
await clear(true)
|
||||
|
||||
try {
|
||||
await KilocodeConfig.migrateBashPermission()
|
||||
|
||||
const writtenConfig = await Filesystem.readJson<Config.Info>(path.join(globalTmp.path, "kilo.json"))
|
||||
expect(writtenConfig.permission).toEqual({
|
||||
"*": "allow",
|
||||
bash: "allow",
|
||||
})
|
||||
} finally {
|
||||
;(Global.Path as { config: string }).config = prev
|
||||
await clear(true)
|
||||
}
|
||||
})
|
||||
|
||||
test("migrates object-form global permission in jsonc", async () => {
|
||||
await using globalTmp = await tmpdir({
|
||||
init: async (dir) => {
|
||||
|
||||
Reference in New Issue
Block a user