mirror of
https://github.com/openclaw/openclaw.git
synced 2026-09-28 14:12:28 +08:00
* test(status): deslop s223 tests * test(onepassword): deslop s225 tests * test(mcp): deslop s224 tests * test(scripts): deslop s215 tests * test(fal): deslop s226 tests * test(feishu): deslop s227 tests * test(amazon-bedrock-mantle): deslop s229 tests * test(lobster): deslop s234 tests * test(comfy): deslop s228 tests * test(irc): deslop s230 tests
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { classifyBundledExtensionSourcePath } from "../../scripts/lib/extension-source-classifier.mts";
|
|
|
|
function expectClassification(
|
|
filePath: string,
|
|
expected: Partial<ReturnType<typeof classifyBundledExtensionSourcePath>>,
|
|
) {
|
|
expect(classifyBundledExtensionSourcePath(filePath)).toEqual({
|
|
normalizedPath: filePath,
|
|
isCodeFile: true,
|
|
isRuntimeApiBarrel: false,
|
|
isPublicApiBarrel: false,
|
|
isTestLike: false,
|
|
isInfraArtifact: false,
|
|
isProductionSource: false,
|
|
...expected,
|
|
});
|
|
}
|
|
|
|
describe("classifyBundledExtensionSourcePath", () => {
|
|
it("treats runtime barrels as non-production source", () => {
|
|
expectClassification("extensions/msteams/runtime-api.ts", {
|
|
isRuntimeApiBarrel: true,
|
|
});
|
|
});
|
|
|
|
it("treats extension tests and fixtures as test-like across naming styles", () => {
|
|
for (const filePath of [
|
|
"extensions/feishu/src/monitor-handler.test.ts",
|
|
"extensions/discord/src/test-fixtures/message.ts",
|
|
"extensions/telegram/src/bot.test-harness.ts",
|
|
"extensions/telegram/src/target-writeback.test-shared.ts",
|
|
]) {
|
|
expectClassification(filePath, { isTestLike: true });
|
|
}
|
|
});
|
|
|
|
it("keeps normal extension production files eligible for guardrails", () => {
|
|
expectClassification("extensions/msteams/src/send.ts", {
|
|
isProductionSource: true,
|
|
});
|
|
});
|
|
});
|