mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:37:38 +00:00
perf(test): trim duplicate e2e suites and harden signal hooks
This commit is contained in:
@@ -221,8 +221,9 @@ describe("gateway server health/presence", () => {
|
||||
test("presence includes client fingerprint", async () => {
|
||||
const identityPath = path.join(os.tmpdir(), `openclaw-device-${randomUUID()}.json`);
|
||||
const identity = loadOrCreateDeviceIdentity(identityPath);
|
||||
const token = process.env.OPENCLAW_GATEWAY_TOKEN?.trim() || undefined;
|
||||
const role = "operator";
|
||||
const scopes: string[] = [];
|
||||
const scopes: string[] = ["operator.admin"];
|
||||
const signedAtMs = Date.now();
|
||||
const payload = buildDeviceAuthPayload({
|
||||
deviceId: identity.deviceId,
|
||||
@@ -231,11 +232,12 @@ describe("gateway server health/presence", () => {
|
||||
role,
|
||||
scopes,
|
||||
signedAtMs,
|
||||
token: null,
|
||||
token: token ?? null,
|
||||
});
|
||||
const ws = await openClient({
|
||||
role,
|
||||
scopes,
|
||||
token,
|
||||
client: {
|
||||
id: GATEWAY_CLIENT_NAMES.FINGERPRINT,
|
||||
version: "9.9.9",
|
||||
@@ -262,8 +264,14 @@ describe("gateway server health/presence", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
const presenceRes = await presenceP;
|
||||
const entries = presenceRes.payload as Array<Record<string, unknown>>;
|
||||
const presenceRes = (await presenceP) as { ok?: boolean; payload?: unknown };
|
||||
expect(presenceRes.ok).toBe(true);
|
||||
const presencePayload = presenceRes.payload;
|
||||
const entries = Array.isArray(presencePayload)
|
||||
? presencePayload
|
||||
: Array.isArray((presencePayload as { presence?: unknown } | undefined)?.presence)
|
||||
? ((presencePayload as { presence: Array<Record<string, unknown>> }).presence ?? [])
|
||||
: [];
|
||||
const clientEntry = entries.find(
|
||||
(e) => e.host === GATEWAY_CLIENT_NAMES.FINGERPRINT && e.version === "9.9.9",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user