test(contracts): cover matrix session binding adapters (#50369)

Merged via squash.

Prepared head SHA: 25412dbc2c
Co-authored-by: ChroniCat <220139611+ChroniCat@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Liu Ricardo
2026-03-19 22:26:37 +08:00
committed by GitHub
parent c7cbc8cc0b
commit 8c01347989
6 changed files with 111 additions and 5 deletions

View File

@@ -1,3 +1,8 @@
export * from "./src/setup-core.js";
export * from "./src/setup-surface.js";
export {
createMatrixThreadBindingManager,
getMatrixThreadBindingManager,
resetMatrixThreadBindingsForTests,
} from "./src/matrix/thread-bindings.js";
export { matrixOnboardingAdapter as matrixSetupWizard } from "./src/onboarding.js";

View File

@@ -173,6 +173,7 @@ function resolveBindingsPath(params: {
auth: MatrixAuth;
accountId: string;
env?: NodeJS.ProcessEnv;
stateDir?: string;
}): string {
const storagePaths = resolveMatrixStoragePaths({
homeserver: params.auth.homeserver,
@@ -181,6 +182,7 @@ function resolveBindingsPath(params: {
accountId: params.accountId,
deviceId: params.auth.deviceId,
env: params.env,
stateDir: params.stateDir,
});
return path.join(storagePaths.rootDir, "thread-bindings.json");
}
@@ -341,6 +343,7 @@ export async function createMatrixThreadBindingManager(params: {
auth: MatrixAuth;
client: MatrixClient;
env?: NodeJS.ProcessEnv;
stateDir?: string;
idleTimeoutMs: number;
maxAgeMs: number;
enableSweeper?: boolean;
@@ -360,6 +363,7 @@ export async function createMatrixThreadBindingManager(params: {
auth: params.auth,
accountId: params.accountId,
env: params.env,
stateDir: params.stateDir,
});
const loaded = await loadBindingsFromDisk(filePath, params.accountId);
for (const record of loaded) {