MCPcopy Create free account
hub / github.com/cameri/nostream / toDbEvent

Function toDbEvent

test/unit/handlers/subscribe-message-handler.spec.ts:22–31  ·  view source on GitHub ↗
(event: Event, metadata: { expires_at?: number; deleted_at?: Date | null } = {})

Source from the content-addressed store, hash-verified

20const { expect } = chai
21
22const toDbEvent = (event: Event, metadata: { expires_at?: number; deleted_at?: Date | null } = {}) => ({
23 event_id: Buffer.from(event.id, 'hex'),
24 event_kind: event.kind,
25 event_pubkey: Buffer.from(event.pubkey, 'hex'),
26 event_created_at: event.created_at,
27 event_content: event.content,
28 event_tags: event.tags,
29 event_signature: Buffer.from(event.sig, 'hex'),
30 ...metadata,
31})
32
33describe('SubscribeMessageHandler', () => {
34 const subscriptionId: SubscriptionId = 'subscriptionId'

Calls

no outgoing calls

Tested by

no test coverage detected