mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 11:25:50 -06:00
fix(qa): use SQLite Matrix E2EE state
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
// Qa Matrix tests cover e2ee client plugin behavior.
|
||||
import { access, mkdtemp, rm } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { testing } from "./e2ee-client.js";
|
||||
@@ -39,6 +41,21 @@ describe("matrix qa e2ee client storage", () => {
|
||||
expect(second.storagePath).toBe(first.storagePath);
|
||||
});
|
||||
|
||||
it("uses plugin state without creating a legacy IndexedDB snapshot", async () => {
|
||||
const outputDir = await mkdtemp(path.join(os.tmpdir(), "matrix-qa-e2ee-storage-"));
|
||||
try {
|
||||
const storage = await testing.prepareMatrixQaE2eeStorage({
|
||||
actorId: "driver",
|
||||
outputDir,
|
||||
scenarioId: "matrix-e2ee-basic-reply",
|
||||
});
|
||||
|
||||
await expect(access(storage.idbSnapshotPath)).rejects.toMatchObject({ code: "ENOENT" });
|
||||
} finally {
|
||||
await rm(outputDir, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("records late-decrypted payload updates for an existing event id", () => {
|
||||
const previous = {
|
||||
eventId: "$reply",
|
||||
|
||||
@@ -322,11 +322,6 @@ async function prepareMatrixQaE2eeStorage(params: {
|
||||
await fs.mkdir(storage.rootDir, { recursive: true });
|
||||
await fs.mkdir(storage.accountDir, { recursive: true });
|
||||
await fs.mkdir(path.dirname(storage.storagePath), { recursive: true });
|
||||
await fs.writeFile(storage.idbSnapshotPath, "[]\n", { flag: "wx" }).catch((error: unknown) => {
|
||||
if ((error as NodeJS.ErrnoException).code !== "EEXIST") {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
return storage;
|
||||
}
|
||||
|
||||
@@ -583,6 +578,7 @@ export const testing = {
|
||||
MATRIX_QA_E2EE_SYNC_FILTER,
|
||||
buildMatrixQaE2eeStoragePaths,
|
||||
findMatrixQaObservedEventMatch,
|
||||
prepareMatrixQaE2eeStorage,
|
||||
shouldRecordMatrixQaObservedEventUpdate,
|
||||
};
|
||||
export { testing as __testing };
|
||||
|
||||
Reference in New Issue
Block a user