test(hooks): remove duplicate loader cases

This commit is contained in:
Peter Steinberger
2026-04-23 11:31:47 +01:00
parent 39a907d7f4
commit 1412ee8a85

View File

@@ -243,28 +243,6 @@ describe("loader", () => {
expect(event.messages).toEqual(["keep-hook"]);
});
it("should load a handler from a module", async () => {
// Create a test handler module
const handlerCode = `
export default async function(event) {
// Test handler
}
`;
const handlerPath = await writeHandlerModule("test-handler.js", handlerCode);
const cfg = createEnabledHooksConfig([
{
event: "command:new",
module: path.basename(handlerPath),
},
]);
const count = await loadInternalHooks(cfg, tmpDir);
expect(count).toBe(1);
const keys = getRegisteredEventKeys();
expect(keys).toContain("command:new");
});
it("should load multiple handlers", async () => {
// Create test handler modules
const handler1Path = await writeHandlerModule("handler1.js");
@@ -363,24 +341,6 @@ describe("loader", () => {
}
});
it("should handle relative paths", async () => {
// Create a handler module
const handlerPath = await writeHandlerModule("relative-handler.js");
// Relative to workspaceDir (tmpDir)
const relativePath = path.relative(tmpDir, handlerPath);
const cfg = createEnabledHooksConfig([
{
event: "command:new",
module: relativePath,
},
]);
const count = await loadInternalHooks(cfg, tmpDir);
expect(count).toBe(1);
});
it("keeps workspace hooks disabled by default until explicitly enabled", async () => {
await writeDiscoveredHook({ hookName: "workspace-hook" });