test: clear nostr broad matchers

This commit is contained in:
Shakker
2026-05-10 16:55:55 +01:00
parent d0f0100bb2
commit e8b7f5f978
3 changed files with 21 additions and 5 deletions

View File

@@ -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,
});
});
});

View File

@@ -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 () => {

View File

@@ -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", () => {