mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 16:43:43 +00:00
chore: Fix types in tests 39/N.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { MsgContext } from "../auto-reply/templating.js";
|
||||
import {
|
||||
type ChannelMatchSource,
|
||||
buildChannelKeyCandidates,
|
||||
normalizeChannelSlug,
|
||||
resolveChannelEntryMatch,
|
||||
@@ -95,10 +96,8 @@ describe("resolveChannelEntryMatchWithFallback", () => {
|
||||
|
||||
describe("applyChannelMatchMeta", () => {
|
||||
it("copies match metadata onto resolved configs", () => {
|
||||
const resolved = applyChannelMatchMeta(
|
||||
{ allowed: true },
|
||||
{ matchKey: "general", matchSource: "direct" },
|
||||
);
|
||||
const base: { matchKey?: string; matchSource?: ChannelMatchSource } = {};
|
||||
const resolved = applyChannelMatchMeta(base, { matchKey: "general", matchSource: "direct" });
|
||||
expect(resolved.matchKey).toBe("general");
|
||||
expect(resolved.matchSource).toBe("direct");
|
||||
});
|
||||
@@ -106,14 +105,20 @@ describe("applyChannelMatchMeta", () => {
|
||||
|
||||
describe("resolveChannelMatchConfig", () => {
|
||||
it("returns null when no entry is matched", () => {
|
||||
const resolved = resolveChannelMatchConfig({ matchKey: "x" }, () => ({ allowed: true }));
|
||||
const resolved = resolveChannelMatchConfig({ matchKey: "x" }, () => {
|
||||
const out: { matchKey?: string; matchSource?: ChannelMatchSource } = {};
|
||||
return out;
|
||||
});
|
||||
expect(resolved).toBeNull();
|
||||
});
|
||||
|
||||
it("resolves entry and applies match metadata", () => {
|
||||
const resolved = resolveChannelMatchConfig(
|
||||
{ entry: { allow: true }, matchKey: "*", matchSource: "wildcard" },
|
||||
() => ({ allowed: true }),
|
||||
() => {
|
||||
const out: { matchKey?: string; matchSource?: ChannelMatchSource } = {};
|
||||
return out;
|
||||
},
|
||||
);
|
||||
expect(resolved?.matchKey).toBe("*");
|
||||
expect(resolved?.matchSource).toBe("wildcard");
|
||||
|
||||
Reference in New Issue
Block a user