mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:10:44 +00:00
test: finish exact function assertion cleanup
This commit is contained in:
@@ -292,17 +292,21 @@ describe("MatrixClient request hardening", () => {
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("injects a guarded fetchFn into matrix-js-sdk", () => {
|
||||
const client = new MatrixClient("https://matrix.example.org", "token", {
|
||||
ssrfPolicy: { allowPrivateNetwork: true },
|
||||
});
|
||||
it("injects a guarded fetchFn into matrix-js-sdk", async () => {
|
||||
const client = new MatrixClient("https://matrix.example.org", "token");
|
||||
expect(client).toBeInstanceOf(MatrixClient);
|
||||
|
||||
expect(lastCreateClientOpts).toMatchObject({
|
||||
baseUrl: "https://matrix.example.org",
|
||||
accessToken: "token",
|
||||
});
|
||||
expect(lastCreateClientOpts?.fetchFn).toEqual(expect.any(Function));
|
||||
const fetchFn = lastCreateClientOpts?.fetchFn as typeof fetch | undefined;
|
||||
if (!fetchFn) {
|
||||
throw new Error("expected Matrix SDK guarded fetch");
|
||||
}
|
||||
await expect(fetchFn("http://127.0.0.1/_matrix/client/v3/account/whoami")).rejects.toThrow(
|
||||
/private|blocked|not allowed/i,
|
||||
);
|
||||
});
|
||||
|
||||
it("prefers authenticated client media downloads", async () => {
|
||||
@@ -603,7 +607,6 @@ describe("MatrixClient request hardening", () => {
|
||||
if (!store) {
|
||||
throw new Error("expected Matrix sync store");
|
||||
}
|
||||
expect(store.flush).toEqual(expect.any(Function));
|
||||
const flushSpy = vi.spyOn(store, "flush").mockResolvedValue();
|
||||
|
||||
await client.stopAndPersist();
|
||||
@@ -1167,11 +1170,17 @@ describe("MatrixClient event bridge", () => {
|
||||
});
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(releaseSyncReady).toEqual(expect.any(Function));
|
||||
if (!releaseSyncReady) {
|
||||
throw new Error("expected Matrix sync ready release callback");
|
||||
}
|
||||
});
|
||||
expect(resolved).toBe(false);
|
||||
|
||||
releaseSyncReady?.();
|
||||
const release = releaseSyncReady;
|
||||
if (!release) {
|
||||
throw new Error("expected Matrix sync ready release callback");
|
||||
}
|
||||
release();
|
||||
await startPromise;
|
||||
|
||||
expect(resolved).toBe(true);
|
||||
|
||||
@@ -904,7 +904,7 @@ describe("dispatchPreparedSlackMessage preview fallback", () => {
|
||||
);
|
||||
|
||||
expect(capturedReplyOptions?.suppressDefaultToolProgressMessages).toBe(true);
|
||||
expect(requireCapturedItemEventHandler()).toEqual(expect.any(Function));
|
||||
await requireCapturedItemEventHandler()({ progressText: "hidden progress" });
|
||||
});
|
||||
|
||||
it("does not create a blank Slack progress draft when label and lines are disabled", async () => {
|
||||
@@ -943,7 +943,7 @@ describe("dispatchPreparedSlackMessage preview fallback", () => {
|
||||
);
|
||||
|
||||
expect(capturedReplyOptions?.suppressDefaultToolProgressMessages).toBe(true);
|
||||
expect(requireCapturedItemEventHandler()).toEqual(expect.any(Function));
|
||||
await requireCapturedItemEventHandler()({ progressText: "hidden partial progress" });
|
||||
});
|
||||
|
||||
it("starts native streams in the first-reply thread for top-level channel messages", async () => {
|
||||
|
||||
Reference in New Issue
Block a user