mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
test: guard plugin record helpers
This commit is contained in:
@@ -45,7 +45,9 @@ function mockRecoveryKeyStdin(value: string): void {
|
||||
}
|
||||
|
||||
function expectRecordFields(record: unknown, expected: Record<string, unknown>) {
|
||||
expect(record).toBeDefined();
|
||||
if (!record || typeof record !== "object") {
|
||||
throw new Error("Expected record");
|
||||
}
|
||||
const actual = record as Record<string, unknown>;
|
||||
for (const [key, value] of Object.entries(expected)) {
|
||||
expect(actual[key]).toEqual(value);
|
||||
|
||||
@@ -300,7 +300,9 @@ describe("dispatchTelegramMessage draft streaming", () => {
|
||||
}
|
||||
|
||||
function expectRecordFields(record: unknown, expected: Record<string, unknown>) {
|
||||
expect(record).toBeDefined();
|
||||
if (!record || typeof record !== "object") {
|
||||
throw new Error("Expected record");
|
||||
}
|
||||
const actual = record as Record<string, unknown>;
|
||||
for (const [key, value] of Object.entries(expected)) {
|
||||
expect(actual[key]).toEqual(value);
|
||||
|
||||
@@ -103,7 +103,9 @@ function mockMediaLoad(fileName: string, contentType: string, data: string) {
|
||||
}
|
||||
|
||||
function expectRecordFields(record: unknown, expected: Record<string, unknown>) {
|
||||
expect(record).toBeDefined();
|
||||
if (!record || typeof record !== "object") {
|
||||
throw new Error("Expected record");
|
||||
}
|
||||
const actual = record as Record<string, unknown>;
|
||||
for (const [key, value] of Object.entries(expected)) {
|
||||
expect(actual[key]).toEqual(value);
|
||||
|
||||
@@ -87,7 +87,9 @@ describe("talk realtime gateway relay", () => {
|
||||
}
|
||||
|
||||
function expectRecordFields(record: unknown, expected: Record<string, unknown>) {
|
||||
expect(record).toBeDefined();
|
||||
if (!record || typeof record !== "object") {
|
||||
throw new Error("Expected record");
|
||||
}
|
||||
const actual = record as Record<string, unknown>;
|
||||
for (const [key, value] of Object.entries(expected)) {
|
||||
expect(actual[key]).toEqual(value);
|
||||
|
||||
Reference in New Issue
Block a user