You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
982 B
25 lines
982 B
import { describe, expect, it } from 'vitest' |
|
import { kinds } from 'nostr-tools' |
|
import { NIP_SEARCH_DOCUMENT_KINDS } from '@/constants' |
|
import { kindsForSingleRelayBrowse, relayUrlIsDocumentRelay } from './single-relay-browse-kinds' |
|
|
|
describe('single-relay-browse-kinds', () => { |
|
it('detects document relays', () => { |
|
expect(relayUrlIsDocumentRelay('wss://essayist.decentnewsroom.com/')).toBe(true) |
|
expect(relayUrlIsDocumentRelay('wss://relay.damus.io/')).toBe(false) |
|
}) |
|
|
|
it('merges document kinds for document relays', () => { |
|
const out = kindsForSingleRelayBrowse('wss://essayist.decentnewsroom.com/', [kinds.ShortTextNote]) |
|
expect(out).toContain(kinds.ShortTextNote) |
|
for (const k of NIP_SEARCH_DOCUMENT_KINDS) { |
|
expect(out).toContain(k) |
|
} |
|
}) |
|
|
|
it('keeps picker kinds only for generic relays', () => { |
|
expect(kindsForSingleRelayBrowse('wss://relay.damus.io/', [kinds.ShortTextNote])).toEqual([ |
|
kinds.ShortTextNote |
|
]) |
|
}) |
|
})
|
|
|