chore: Fix types in tests 39/N.

This commit is contained in:
cpojer
2026-02-17 15:47:58 +09:00
parent 084e39b519
commit c4bd82d81d
11 changed files with 59 additions and 31 deletions

View File

@@ -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");