chore(deadcode): remove test-only channel helpers · openclaw/openclaw@9509330
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,6 @@ import {
|
4 | 4 | buildIrcAllowlistCandidates, |
5 | 5 | normalizeIrcAllowEntry, |
6 | 6 | normalizeIrcMessagingTarget, |
7 | | -resolveIrcAllowlistMatch, |
8 | 7 | } from "./normalize.js"; |
9 | 8 | |
10 | 9 | describe("irc normalize", () => { |
@@ -33,24 +32,5 @@ describe("irc normalize", () => {
|
33 | 32 | expect(buildIrcAllowlistCandidates(message)).toContain("alice!ident@example.org"); |
34 | 33 | expect(buildIrcAllowlistCandidates(message)).not.toContain("alice"); |
35 | 34 | expect(buildIrcAllowlistCandidates(message, { allowNameMatching: true })).toContain("alice"); |
36 | | -expect( |
37 | | -resolveIrcAllowlistMatch({ |
38 | | -allowFrom: ["alice!ident@example.org"], |
39 | | - message, |
40 | | -}).allowed, |
41 | | -).toBe(true); |
42 | | -expect( |
43 | | -resolveIrcAllowlistMatch({ |
44 | | -allowFrom: ["alice"], |
45 | | - message, |
46 | | -}).allowed, |
47 | | -).toBe(false); |
48 | | -expect( |
49 | | -resolveIrcAllowlistMatch({ |
50 | | -allowFrom: ["alice"], |
51 | | - message, |
52 | | -allowNameMatching: true, |
53 | | -}).allowed, |
54 | | -).toBe(true); |
55 | 35 | }); |
56 | 36 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,6 @@
|
2 | 2 | import { |
3 | 3 | normalizeLowercaseStringOrEmpty, |
4 | 4 | normalizeOptionalLowercaseString, |
5 | | -normalizeStringEntriesLower, |
6 | 5 | } from "openclaw/plugin-sdk/string-coerce-runtime"; |
7 | 6 | import { hasIrcControlChars } from "./control-chars.js"; |
8 | 7 | import type { IrcInboundMessage } from "./types.js"; |
@@ -85,23 +84,3 @@ export function buildIrcAllowlistCandidates(
|
85 | 84 | } |
86 | 85 | return [...candidates]; |
87 | 86 | } |
88 | | - |
89 | | -export function resolveIrcAllowlistMatch(params: { |
90 | | -allowFrom: string[]; |
91 | | -message: IrcInboundMessage; |
92 | | -allowNameMatching?: boolean; |
93 | | -}): { allowed: boolean; source?: string } { |
94 | | -const allowFrom = new Set(normalizeStringEntriesLower(params.allowFrom)); |
95 | | -if (allowFrom.has("*")) { |
96 | | -return { allowed: true, source: "wildcard" }; |
97 | | -} |
98 | | -const candidates = buildIrcAllowlistCandidates(params.message, { |
99 | | -allowNameMatching: params.allowNameMatching, |
100 | | -}); |
101 | | -for (const candidate of candidates) { |
102 | | -if (allowFrom.has(candidate)) { |
103 | | -return { allowed: true, source: candidate }; |
104 | | -} |
105 | | -} |
106 | | -return { allowed: false }; |
107 | | -} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,6 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
5 | 5 | import { installWebAutoReplyUnitTestHooks, makeSessionStore } from "./auto-reply.test-harness.js"; |
6 | 6 | import { buildMentionConfig } from "./auto-reply/mentions.js"; |
7 | 7 | import { createEchoTracker } from "./auto-reply/monitor/echo.js"; |
8 | | -import { awaitBackgroundTasks } from "./auto-reply/monitor/last-route.js"; |
9 | 8 | import { createWebOnMessageHandler } from "./auto-reply/monitor/on-message.js"; |
10 | 9 | import { createTestWebInboundMessage } from "./inbound/test-message.test-helper.js"; |
11 | 10 | |
@@ -134,7 +133,8 @@ describe("web auto-reply last-route", () => {
|
134 | 133 | }), |
135 | 134 | ); |
136 | 135 | |
137 | | -await awaitBackgroundTasks(backgroundTasks); |
| 136 | +await Promise.allSettled(backgroundTasks); |
| 137 | +backgroundTasks.clear(); |
138 | 138 | |
139 | 139 | expect(updateLastRouteInBackgroundMock).toHaveBeenCalledTimes(1); |
140 | 140 | const updateParams = updateLastRouteInBackgroundMock.mock.calls.at(0)?.[0] as |
@@ -211,7 +211,8 @@ describe("web auto-reply last-route", () => {
|
211 | 211 | }), |
212 | 212 | ); |
213 | 213 | |
214 | | -await awaitBackgroundTasks(backgroundTasks); |
| 214 | +await Promise.allSettled(backgroundTasks); |
| 215 | +backgroundTasks.clear(); |
215 | 216 | |
216 | 217 | expect(updateLastRouteInBackgroundMock).toHaveBeenCalledTimes(1); |
217 | 218 | const updateParams = updateLastRouteInBackgroundMock.mock.calls.at(0)?.[0] as |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,12 +51,3 @@ export function updateLastRouteInBackground(params: {
|
51 | 51 | }); |
52 | 52 | trackBackgroundTask(params.backgroundTasks, task); |
53 | 53 | } |
54 | | - |
55 | | -export function awaitBackgroundTasks(backgroundTasks: Set<Promise<unknown>>) { |
56 | | -if (backgroundTasks.size === 0) { |
57 | | -return Promise.resolve(); |
58 | | -} |
59 | | -return Promise.allSettled(backgroundTasks).then(() => { |
60 | | -backgroundTasks.clear(); |
61 | | -}); |
62 | | -} |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。