05605bdf28
* vastly simplify the api * add missing await * add eose to emitter * add eose to conn * add eose to the client * eose test * improve test suite, add dm tests * demonstrate that nostr-rs-relay auth options don't work * readme files * cleanup * fetch relay info * test readyState * export fetchRelayInfo * cleanup * better async/await linting * use strictEqual in tests * additional eslint rules * allow arbitrary extensions * saner error handling * update README * implement nip-02 --------- Co-authored-by: Kieran <kieran@harkin.me>
27 lines
967 B
TypeScript
27 lines
967 B
TypeScript
import assert from "assert"
|
|
import { Nostr } from "../src/client"
|
|
import { setup } from "./setup"
|
|
|
|
describe("relay info", () => {
|
|
it("fetching relay info", (done) => {
|
|
setup(done, ({ publisher, done }) => {
|
|
assert.strictEqual(publisher.relays.length, 1)
|
|
const relay = publisher.relays[0]
|
|
assert.strictEqual(relay.readyState, Nostr.OPEN)
|
|
if (relay.readyState === Nostr.OPEN) {
|
|
assert.strictEqual(relay.info.name, "nostr-rs-relay")
|
|
assert.strictEqual(relay.info.description, "nostr-rs-relay description")
|
|
assert.strictEqual(relay.info.pubkey, undefined)
|
|
assert.strictEqual(relay.info.contact, "mailto:contact@example.com")
|
|
assert.ok((relay.info.supported_nips?.length ?? 0) > 0)
|
|
assert.strictEqual(
|
|
relay.info.software,
|
|
"https://git.sr.ht/~gheartsfield/nostr-rs-relay"
|
|
)
|
|
assert.strictEqual(relay.info.version, "0.8.8")
|
|
}
|
|
done()
|
|
})
|
|
})
|
|
})
|