Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openclaw/extensions/discord/src/monitor/   (Openclaw AI Version 22©)  Datei vom 26.3.2026 mit Größe 1 kB image not shown  

Quelle  typing.test.ts

  Sprache: JAVA
 

import { Routes } from "discord-api-types/v10";
import { describe, expect, it, vi } from "vitest";
import { sendTyping } from "./typing.js";

describe("sendTyping", () => {
  it("uses the direct Discord typing REST endpoint", async () => {
    const rest = {
      post: vi.fn(async () => {}),
    };

    await sendTyping({
      // @ts-expect-error test stub only needs rest.post
      rest,
      channelId: "12345",
    });

    expect(rest.post).toHaveBeenCalledTimes(1);
    expect(rest.post).toHaveBeenCalledWith(Routes.channelTyping("12345"));
  });

  it("times out when the typing endpoint hangs", async () => {
    vi.useFakeTimers();
    try {
      const rest = {
        post: vi.fn(() => new Promise(() => {})),
      };

      const promise = sendTyping({
        // @ts-expect-error test stub only needs rest.post
        rest,
        channelId: "12345",
      });
      const rejection = expect(promise).rejects.toThrow("discord typing start timed out");

      await vi.advanceTimersByTimeAsync(5_000);

      await rejection;
    } finally {
      vi.useRealTimers();
    }
  });
});

Messung V0.5 in Prozent
C=99 H=98 G=98

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.