Skip to content

Commit d3f7f7d

Browse files
committed
chore(deadcode): remove unused test-only helpers
1 parent 7cc21ef commit d3f7f7d

6 files changed

Lines changed: 14 additions & 80 deletions

File tree

extensions/llama-cpp/index.test.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ vi.mock("openclaw/plugin-sdk/memory-core-host-engine-embeddings", () => ({
2222
import llamaCppPlugin from "./index.js";
2323
import {
2424
DEFAULT_LLAMA_CPP_EMBEDDING_MODEL,
25-
createLlamaCppEmbeddingProvider,
2625
createLlamaCppMemoryEmbeddingProvider,
2726
formatLlamaCppSetupError,
2827
llamaCppEmbeddingProviderAdapter,
@@ -71,14 +70,16 @@ describe("llama.cpp provider plugin", () => {
7170
});
7271
const abortController = new AbortController();
7372

74-
const provider = await createLlamaCppEmbeddingProvider(
75-
{
76-
config: {},
77-
provider: "local",
78-
model: "text-embedding-3-small",
79-
},
80-
{ nodeLlamaCppImportUrl: "file:///plugin/node-llama-cpp.js" },
81-
);
73+
const result = await llamaCppEmbeddingProviderAdapter.create({
74+
config: {},
75+
provider: "local",
76+
model: "text-embedding-3-small",
77+
});
78+
const provider = result.provider;
79+
expect(provider).not.toBeNull();
80+
if (!provider) {
81+
throw new Error("expected llama.cpp provider");
82+
}
8283

8384
await expect(provider.embed("hello")).resolves.toEqual([0.6, 0.8]);
8485
await expect(
@@ -100,7 +101,7 @@ describe("llama.cpp provider plugin", () => {
100101
},
101102
},
102103
{
103-
nodeLlamaCppImportUrl: "file:///plugin/node-llama-cpp.js",
104+
nodeLlamaCppImportUrl: expect.stringContaining("node-llama-cpp"),
104105
},
105106
);
106107
const workerProvider =

extensions/llama-cpp/src/embedding-provider.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,6 @@ function adaptMemoryEmbeddingProvider(provider: MemoryEmbeddingProvider): Embedd
182182
};
183183
}
184184

185-
export async function createLlamaCppEmbeddingProvider(
186-
options: EmbeddingProviderCreateOptions,
187-
runtimeOptions: LlamaCppEmbeddingProviderRuntimeOptions = {},
188-
): Promise<EmbeddingProvider> {
189-
const result = await createLlamaCppEmbeddingProviderResult(options, runtimeOptions);
190-
if (!result.provider) {
191-
throw new Error("llama.cpp local embedding provider was unavailable");
192-
}
193-
return result.provider;
194-
}
195-
196185
export async function createLlamaCppMemoryEmbeddingProvider(
197186
options: MemoryEmbeddingProviderCreateOptions,
198187
runtimeOptions: LlamaCppEmbeddingProviderRuntimeOptions = {},

extensions/msteams/src/monitor-handler.sso.test.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import {
99
type MSTeamsSsoFetch,
1010
handleSigninTokenExchangeInvoke,
1111
handleSigninVerifyStateInvoke,
12-
parseSigninTokenExchangeValue,
13-
parseSigninVerifyStateValue,
1412
} from "./sso.js";
1513

1614
function createMemorySsoTokenStore(): MSTeamsSsoTokenStore {
@@ -68,29 +66,6 @@ function createFakeFetch(handlers: Array<(url: string, init?: unknown) => unknow
6866
return { fetchImpl, calls };
6967
}
7068

71-
describe("msteams signin invoke value parsers", () => {
72-
it("parses signin/tokenExchange values", () => {
73-
expect(
74-
parseSigninTokenExchangeValue({
75-
id: "flow-1",
76-
connectionName: "Graph",
77-
token: "eyJ...",
78-
}),
79-
).toEqual({ id: "flow-1", connectionName: "Graph", token: "eyJ..." });
80-
});
81-
82-
it("rejects non-object signin/tokenExchange values", () => {
83-
expect(parseSigninTokenExchangeValue(null)).toBeNull();
84-
expect(parseSigninTokenExchangeValue("nope")).toBeNull();
85-
});
86-
87-
it("parses signin/verifyState values", () => {
88-
expect(parseSigninVerifyStateValue({ state: "123456" })).toEqual({ state: "123456" });
89-
expect(parseSigninVerifyStateValue({})).toEqual({ state: undefined });
90-
expect(parseSigninVerifyStateValue(null)).toBeNull();
91-
});
92-
});
93-
9469
describe("handleSigninTokenExchangeInvoke", () => {
9570
it("exchanges the Teams token and persists the result", async () => {
9671
const { fetchImpl, calls } = createFakeFetch([

extensions/msteams/src/sso.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -96,32 +96,6 @@ type SigninVerifyStateValue = {
9696
state?: string;
9797
};
9898

99-
/**
100-
* Extract and validate the `signin/tokenExchange` activity value. Teams
101-
* delivers `{ id, connectionName, token }`; any field may be missing on
102-
* malformed invocations, so callers should check the parsed result.
103-
*/
104-
export function parseSigninTokenExchangeValue(value: unknown): SigninTokenExchangeValue | null {
105-
if (!value || typeof value !== "object") {
106-
return null;
107-
}
108-
const obj = value as Record<string, unknown>;
109-
const id = typeof obj.id === "string" ? obj.id : undefined;
110-
const connectionName = typeof obj.connectionName === "string" ? obj.connectionName : undefined;
111-
const token = typeof obj.token === "string" ? obj.token : undefined;
112-
return { id, connectionName, token };
113-
}
114-
115-
/** Extract the `signin/verifyState` activity value `{ state }`. */
116-
export function parseSigninVerifyStateValue(value: unknown): SigninVerifyStateValue | null {
117-
if (!value || typeof value !== "object") {
118-
return null;
119-
}
120-
const obj = value as Record<string, unknown>;
121-
const state = typeof obj.state === "string" ? obj.state : undefined;
122-
return { state };
123-
}
124-
12599
type UserTokenServiceCallParams = {
126100
baseUrl: string;
127101
path: string;

extensions/qa-lab/src/web-runtime.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ vi.mock("playwright-core", () => ({
4444
}));
4545

4646
import {
47-
closeAllQaWebSessions,
4847
closeQaWebSessions,
4948
qaWebEvaluate,
5049
qaWebOpenPage,
@@ -114,7 +113,7 @@ describe("qa web runtime", () => {
114113
});
115114
const snapshot = await qaWebSnapshot({ pageId: opened.pageId, maxChars: 5 });
116115
const evaluated = await qaWebEvaluate({ pageId: opened.pageId, expression: "'ok'" });
117-
await closeAllQaWebSessions();
116+
await closeQaWebSessions();
118117

119118
const launchOptions = requireLaunchOptions();
120119
expect(launchOptions?.channel).toBe("chrome");
@@ -144,7 +143,7 @@ describe("qa web runtime", () => {
144143
);
145144
const snapshot = await qaWebSnapshot({ pageId: second.pageId });
146145
expect(snapshot.text).toBe("hello from body");
147-
await closeAllQaWebSessions();
146+
await closeQaWebSessions();
148147
});
149148

150149
it("caps oversized web runtime timeouts", async () => {
@@ -166,7 +165,7 @@ describe("qa web runtime", () => {
166165
expression: "'ok'",
167166
timeoutMs: Number.MAX_SAFE_INTEGER,
168167
});
169-
await closeAllQaWebSessions();
168+
await closeQaWebSessions();
170169

171170
expect(goto).toHaveBeenCalledWith("http://127.0.0.1:3000/chat", {
172171
waitUntil: "domcontentloaded",

extensions/qa-lab/src/web-runtime.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,3 @@ export async function closeQaWebSessions(pageIds?: Iterable<string>): Promise<vo
207207
await session.browser.close().catch(() => {});
208208
}
209209
}
210-
211-
export async function closeAllQaWebSessions(): Promise<void> {
212-
await closeQaWebSessions();
213-
}

0 commit comments

Comments
 (0)