test(builtin-commands): batch 10 (2 files)

This commit is contained in:
YeonGyu-Kim
2026-05-30 19:12:03 +09:00
parent 5f40ab9052
commit 486bc46305
2 changed files with 69 additions and 0 deletions
@@ -0,0 +1,16 @@
/// <reference path="../../../bun-test.d.ts" />
import { describe, expect, test } from "bun:test"
import { loadBuiltinCommands } from "./commands"
describe("init-deep skill migration", () => {
test("#given builtin commands #when loaded #then init-deep no longer ships as a command", () => {
// given
// when
const commands = loadBuiltinCommands()
// then
expect(commands["init-deep"]).toBeUndefined()
})
})
+53
View File
@@ -0,0 +1,53 @@
import { describe, expect, test } from "bun:test"
import { stat } from "node:fs/promises"
describe("shared skills package manifest", () => {
test("#given root package metadata #when shared-skills package is required #then workspace and tarball entries include it", async () => {
// given
const rootPackageJson = await Bun.file("package.json").json()
// when
const workspaces = rootPackageJson.workspaces
const files = rootPackageJson.files
const devDependency = rootPackageJson.devDependencies["@oh-my-opencode/shared-skills"]
const sharedPackageJson = await Bun.file("packages/shared-skills/package.json").json()
// then
expect(workspaces).toContain("packages/shared-skills")
expect(files).toContain("packages/shared-skills/skills")
expect(devDependency).toBe("workspace:*")
expect(sharedPackageJson).toEqual({
name: "@oh-my-opencode/shared-skills",
version: "0.1.0",
type: "module",
private: true,
description: "Cross-harness SKILL.md files shared between OMO and Codex",
exports: {
".": "./index.mjs",
},
files: ["index.mjs", "skills"],
})
})
test("#given shared user skills #when copied into the package #then frontmatter and resource directories are preserved", async () => {
// given
const copiedSkills = ["debugging", "programming", "refactor", "remove-ai-slops", "ulw-plan"] as const
// when
const skillFiles = await Promise.all(
copiedSkills.map(async (skillName) => ({
name: skillName,
content: await Bun.file(`packages/shared-skills/skills/${skillName}/SKILL.md`).text(),
})),
)
// then
for (const skill of skillFiles) {
expect(skill.content.startsWith("---\n")).toBe(true)
expect(skill.content).toContain(`name: ${skill.name}`)
}
expect((await stat("packages/shared-skills/skills/debugging/references")).isDirectory()).toBe(true)
expect((await stat("packages/shared-skills/skills/programming/references")).isDirectory()).toBe(true)
expect((await stat("packages/shared-skills/skills/programming/scripts")).isDirectory()).toBe(true)
})
})