mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
test: clear nostr broad matchers
This commit is contained in:
@@ -298,7 +298,23 @@ describe("Metrics fuzz", () => {
|
||||
expect(metrics.emit("relay.connect", 1, { relay: longUrl })).toBeUndefined();
|
||||
|
||||
const snapshot = metrics.getSnapshot();
|
||||
expect(snapshot.relays[longUrl]).toEqual(expect.objectContaining({ connects: 1 }));
|
||||
expect(snapshot.relays[longUrl]).toEqual({
|
||||
connects: 1,
|
||||
disconnects: 0,
|
||||
reconnects: 0,
|
||||
errors: 0,
|
||||
messagesReceived: {
|
||||
event: 0,
|
||||
eose: 0,
|
||||
closed: 0,
|
||||
notice: 0,
|
||||
ok: 0,
|
||||
auth: 0,
|
||||
},
|
||||
circuitBreakerState: "closed",
|
||||
circuitBreakerOpens: 0,
|
||||
circuitBreakerCloses: 0,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ describe("nostr-profile-http", () => {
|
||||
// The schema validation catches non-https URLs before SSRF check
|
||||
expect(data.error).toBe("Validation failed");
|
||||
expect(Array.isArray(data.details)).toBe(true);
|
||||
expect(data.details).toEqual(expect.arrayContaining([expect.stringContaining("https")]));
|
||||
expect(data.details).toEqual(["picture: URL must use https:// protocol"]);
|
||||
});
|
||||
|
||||
it("does not persist if all relays fail", async () => {
|
||||
|
||||
@@ -223,7 +223,7 @@ describe("validateProfile", () => {
|
||||
const result = validateProfile(profile);
|
||||
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.errors).toEqual(expect.arrayContaining([expect.stringContaining("https://")]));
|
||||
expect(result.errors).toEqual(["picture: URL must use https:// protocol"]);
|
||||
});
|
||||
|
||||
it("rejects profile with javascript: URL", () => {
|
||||
@@ -256,7 +256,7 @@ describe("validateProfile", () => {
|
||||
const result = validateProfile(profile);
|
||||
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.errors).toEqual(expect.arrayContaining([expect.stringContaining("256")]));
|
||||
expect(result.errors).toEqual(["name: Too big: expected string to have <=256 characters"]);
|
||||
});
|
||||
|
||||
it("rejects about exceeding 2000 characters", () => {
|
||||
@@ -267,7 +267,7 @@ describe("validateProfile", () => {
|
||||
const result = validateProfile(profile);
|
||||
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.errors).toEqual(expect.arrayContaining([expect.stringContaining("2000")]));
|
||||
expect(result.errors).toEqual(["about: Too big: expected string to have <=2000 characters"]);
|
||||
});
|
||||
|
||||
it("accepts empty profile", () => {
|
||||
|
||||
Reference in New Issue
Block a user