Sifa professional network API (Fastify, AT Protocol, Jetstream)
sifa.id/
1import { describe, it, expect } from 'vitest';
2import { buildJetstreamUrl, WANTED_COLLECTIONS } from '../../src/jetstream/client.js';
3
4describe('Jetstream client', () => {
5 it('builds URL with wanted collections', () => {
6 const url = buildJetstreamUrl('wss://jetstream1.us-east.bsky.network/subscribe');
7 expect(url).toContain('wantedCollections=id.sifa.profile.self');
8 expect(url).toContain('wantedCollections=id.sifa.profile.position');
9 expect(url).toContain('wantedCollections=id.sifa.graph.follow');
10 });
11
12 it('includes cursor when provided', () => {
13 const url = buildJetstreamUrl('wss://jetstream1.us-east.bsky.network/subscribe', 1234567890n);
14 expect(url).toContain('cursor=1234567890');
15 });
16
17 it('lists all id.sifa.* collections', () => {
18 expect(WANTED_COLLECTIONS).toContain('id.sifa.profile.self');
19 expect(WANTED_COLLECTIONS).toContain('id.sifa.profile.position');
20 expect(WANTED_COLLECTIONS).toContain('id.sifa.profile.education');
21 expect(WANTED_COLLECTIONS).toContain('id.sifa.profile.skill');
22 expect(WANTED_COLLECTIONS).toContain('id.sifa.graph.follow');
23 expect(WANTED_COLLECTIONS).toContain('id.sifa.endorsement');
24 });
25});