| 1 | import { describe, expect, it } from "vitest" ; |
| 2 | |
| 3 | const relayURL = process.env.RELAY_URL ?? "ws://127.0.0.1:7447" ; |
| 4 | const httpURL = relayURL.replace(/^ws/, "http" ).replace(/\/$/, "" ) + "/" ; |
| 5 | |
| 6 | describe("NIP-11 self-hosted compatibility" , () => { |
| 7 | it("preserves the information assertions while omitting hosted quota" , async () => { |
| 8 | const response = await fetch(httpURL, { headers: { Accept: "application/nostr+json" } }); |
| 9 | expect(response.status).toBe(200); |
| 10 | expect(response.headers.get("content-type" )).toContain("application/nostr+json" ); |
| 11 | const document: any = await response.json(); |
| 12 | expect(typeof document.name).toBe("string" ); |
| 13 | for (const nip of [1, 9, 11, 40, 42, 45, 50, 62, 67, 70, 77]) expect(document.supported_nips).toContain(nip); |
| 14 | expect(document.limitation.max_subid_length).toBeGreaterThanOrEqual(64); |
| 15 | expect(document.limitation.max_limit).toBeUndefined(); |
| 16 | }); |
| 17 | }); |