about summary refs log tree commit diff
path: root/jest/test-pds.ts
diff options
context:
space:
mode:
Diffstat (limited to 'jest/test-pds.ts')
-rw-r--r--jest/test-pds.ts27
1 files changed, 26 insertions, 1 deletions
diff --git a/jest/test-pds.ts b/jest/test-pds.ts
index 48b73e848..0c9d946fc 100644
--- a/jest/test-pds.ts
+++ b/jest/test-pds.ts
@@ -2,7 +2,7 @@ import net from 'net'
 import path from 'path'
 import fs from 'fs'
 import {TestPds as DevEnvTestPDS, TestNetworkNoAppView} from '@atproto/dev-env'
-import {BskyAgent} from '@atproto/api'
+import {AtUri, BskyAgent} from '@atproto/api'
 
 export interface TestUser {
   email: string
@@ -212,6 +212,31 @@ class Mocker {
     return await agent.like(uri, cid)
   }
 
+  async createFeed(user: string) {
+    const agent = this.users[user]?.agent
+    if (!agent) {
+      throw new Error(`Not a user: ${user}`)
+    }
+    const fg1Uri = AtUri.make(
+      this.users[user].did,
+      'app.bsky.feed.generator',
+      'alice-favs',
+    )
+    const avatarRes = await agent.api.com.atproto.repo.uploadBlob(this.pic, {
+      encoding: 'image/png',
+    })
+    return await agent.api.app.bsky.feed.generator.create(
+      {repo: this.users[user].did, rkey: fg1Uri.rkey},
+      {
+        did: 'did:web:fake.com',
+        displayName: 'alices feed',
+        description: 'all my fav stuff',
+        avatar: avatarRes.data.blob,
+        createdAt: new Date().toISOString(),
+      },
+    )
+  }
+
   async createInvite(forAccount: string) {
     const agent = new BskyAgent({service: this.agent.service})
     await agent.api.com.atproto.server.createInviteCode(