tests
This commit is contained in:
parent
65f03894a8
commit
83823959e3
2 changed files with 24 additions and 2 deletions
|
|
@ -13,14 +13,16 @@ const state = path.join(xdgState!, app)
|
|||
export namespace Global {
|
||||
export const Path = {
|
||||
// Allow override via OPENCODE_TEST_HOME for test isolation
|
||||
home: process.env.OPENCODE_TEST_HOME || os.homedir(),
|
||||
get home() {
|
||||
return process.env.OPENCODE_TEST_HOME || os.homedir()
|
||||
},
|
||||
data,
|
||||
bin: path.join(data, "bin"),
|
||||
log: path.join(data, "log"),
|
||||
cache,
|
||||
config,
|
||||
state,
|
||||
} as const
|
||||
}
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
|
|
|
|||
|
|
@ -144,3 +144,23 @@ test("discovers global skills from ~/.claude/skills/ directory", async () => {
|
|||
},
|
||||
})
|
||||
})
|
||||
|
||||
test("returns empty array when no skills exist", async () => {
|
||||
await using tmp = await tmpdir({ git: true })
|
||||
|
||||
// Override global home to a directory without any skills
|
||||
const originalHome = process.env.OPENCODE_TEST_HOME
|
||||
process.env.OPENCODE_TEST_HOME = tmp.path
|
||||
|
||||
try {
|
||||
await Instance.provide({
|
||||
directory: tmp.path,
|
||||
fn: async () => {
|
||||
const skills = await Skill.all()
|
||||
expect(skills).toEqual([])
|
||||
},
|
||||
})
|
||||
} finally {
|
||||
process.env.OPENCODE_TEST_HOME = originalHome
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue