mirror of https://github.com/openclaw/openclaw.git
fix(matrix): narrow lazy test module access
This commit is contained in:
parent
1d05cbba7a
commit
5a0fd1cffc
|
|
@ -53,6 +53,13 @@ const {
|
|||
let credentialsReadModule: typeof import("./credentials-read.js") | undefined;
|
||||
let sdkModule: typeof import("./sdk.js") | undefined;
|
||||
|
||||
function requireCredentialsReadModule(): typeof import("./credentials-read.js") {
|
||||
if (!credentialsReadModule) {
|
||||
throw new Error("credentials-read test module not initialized");
|
||||
}
|
||||
return credentialsReadModule;
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
installMatrixTestRuntime();
|
||||
});
|
||||
|
|
@ -597,10 +604,11 @@ describe("resolveMatrixAuth", () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.mocked(credentialsReadModule.loadMatrixCredentials).mockReset();
|
||||
vi.mocked(credentialsReadModule.loadMatrixCredentials).mockReturnValue(null);
|
||||
vi.mocked(credentialsReadModule.credentialsMatchConfig).mockReset();
|
||||
vi.mocked(credentialsReadModule.credentialsMatchConfig).mockReturnValue(false);
|
||||
const readModule = requireCredentialsReadModule();
|
||||
vi.mocked(readModule.loadMatrixCredentials).mockReset();
|
||||
vi.mocked(readModule.loadMatrixCredentials).mockReturnValue(null);
|
||||
vi.mocked(readModule.credentialsMatchConfig).mockReset();
|
||||
vi.mocked(readModule.credentialsMatchConfig).mockReturnValue(false);
|
||||
saveMatrixCredentialsMock.mockReset();
|
||||
touchMatrixCredentialsMock.mockReset();
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue