mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-06 04:53:41 +00:00
16 lines
679 B
TypeScript
16 lines
679 B
TypeScript
// Assertion helpers for auth token redaction and token shape tests.
|
|
import { expect } from "vitest";
|
|
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
|
|
|
/** Asserts the generated Gateway auth token is both returned and persisted. */
|
|
export function expectGeneratedTokenPersistedToGatewayAuth(params: {
|
|
generatedToken?: string;
|
|
authToken?: string;
|
|
persistedConfig?: OpenClawConfig;
|
|
}) {
|
|
expect(params.generatedToken).toMatch(/^[0-9a-f]{48}$/);
|
|
expect(params.authToken).toBe(params.generatedToken);
|
|
expect(params.persistedConfig?.gateway?.auth?.mode).toBe("token");
|
|
expect(params.persistedConfig?.gateway?.auth?.token).toBe(params.generatedToken);
|
|
}
|