Tests: fix boundary and late-run drift

This commit is contained in:
Peter Steinberger
2026-04-07 19:58:16 +08:00
parent 1cec37184c
commit 5390eadc4e
7 changed files with 68 additions and 75 deletions

View File

@@ -1,4 +1,4 @@
import { afterEach, describe, expect, it } from "vitest";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
clearMemoryEmbeddingProviders,
getMemoryEmbeddingProvider,
@@ -12,6 +12,7 @@ import {
} from "./memory-embedding-providers.js";
const MEMORY_EMBEDDING_PROVIDERS_KEY = Symbol.for("openclaw.memoryEmbeddingProviders");
const INITIAL_REGISTERED_MEMORY_EMBEDDING_PROVIDERS = listRegisteredMemoryEmbeddingProviders();
function createAdapter(id: string): MemoryEmbeddingProviderAdapter {
return {
@@ -92,10 +93,14 @@ function expectRegisteredProviderSnapshotCase(params: {
});
}
afterEach(() => {
beforeEach(() => {
clearMemoryEmbeddingProviders();
});
afterEach(() => {
restoreRegisteredMemoryEmbeddingProviders(INITIAL_REGISTERED_MEMORY_EMBEDDING_PROVIDERS);
});
describe("memory embedding provider registry", () => {
it("registers and lists adapters in insertion order", () => {
const alpha = createAdapter("alpha");