mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 19:20:21 +00:00
fix(ci): reduce slow channel test skew
This commit is contained in:
@@ -5,10 +5,7 @@ export {
|
||||
resolveConfiguredFromRequiredCredentialStatuses,
|
||||
} from "openclaw/plugin-sdk/channel-status";
|
||||
export { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
||||
export {
|
||||
looksLikeSlackTargetId,
|
||||
normalizeSlackMessagingTarget,
|
||||
} from "openclaw/plugin-sdk/slack-targets";
|
||||
export { looksLikeSlackTargetId, normalizeSlackMessagingTarget } from "./targets.js";
|
||||
export type { ChannelPlugin, OpenClawConfig, SlackAccountConfig } from "openclaw/plugin-sdk/slack";
|
||||
export {
|
||||
buildChannelConfigSchema,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { normalizeSlackMessagingTarget } from "openclaw/plugin-sdk/slack";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseSlackTarget, resolveSlackChannelId } from "./targets.js";
|
||||
import {
|
||||
normalizeSlackMessagingTarget,
|
||||
parseSlackTarget,
|
||||
resolveSlackChannelId,
|
||||
} from "./targets.js";
|
||||
|
||||
describe("parseSlackTarget", () => {
|
||||
it("parses user mentions and prefixes", () => {
|
||||
|
||||
@@ -55,3 +55,27 @@ export function resolveSlackChannelId(raw: string): string {
|
||||
const target = parseSlackTarget(raw, { defaultKind: "channel" });
|
||||
return requireTargetKind({ platform: "Slack", target, kind: "channel" });
|
||||
}
|
||||
|
||||
export function normalizeSlackMessagingTarget(raw: string): string | undefined {
|
||||
return parseSlackTarget(raw, { defaultKind: "channel" })?.normalized;
|
||||
}
|
||||
|
||||
export function looksLikeSlackTargetId(raw: string): boolean {
|
||||
const trimmed = raw.trim();
|
||||
if (!trimmed) {
|
||||
return false;
|
||||
}
|
||||
if (/^<@([A-Z0-9]+)>$/i.test(trimmed)) {
|
||||
return true;
|
||||
}
|
||||
if (/^(user|channel):/i.test(trimmed)) {
|
||||
return true;
|
||||
}
|
||||
if (/^slack:/i.test(trimmed)) {
|
||||
return true;
|
||||
}
|
||||
if (/^[@#]/.test(trimmed)) {
|
||||
return true;
|
||||
}
|
||||
return /^[CUWGD][A-Z0-9]{8,}$/i.test(trimmed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user