about summary refs log tree commit diff
path: root/jest
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2024-03-19 17:54:40 -0700
committerGitHub <noreply@github.com>2024-03-19 17:54:40 -0700
commit54f424d0476f7da221b890c9096886b3ca3ac472 (patch)
treec45d1ee2ef89978b8bf064cec0d94f9e37b53185 /jest
parenta90566d86439a96509967f522069a4be729dfc1b (diff)
downloadvoidsky-54f424d0476f7da221b890c9096886b3ca3ac472.tar.zst
Various e2e test fixes (#3284)
* Just use the first picture every time

* Add missing testIDs

* Various test fixes

* Use simplified link fetcher for e2e

* Disable tests for now-n

* Update test-env creation
Diffstat (limited to 'jest')
-rw-r--r--jest/test-pds.ts36
1 files changed, 33 insertions, 3 deletions
diff --git a/jest/test-pds.ts b/jest/test-pds.ts
index 51d964394..b70a9abf0 100644
--- a/jest/test-pds.ts
+++ b/jest/test-pds.ts
@@ -72,6 +72,7 @@ export async function createServer(
   const phoneParams = phoneRequired
     ? {
         phoneVerificationRequired: true,
+        phoneVerificationProvider: 'twilio',
         twilioAccountSid: 'ACXXXXXXX',
         twilioAuthToken: 'AUTH',
         twilioServiceSid: 'VAXXXXXXXX',
@@ -95,6 +96,35 @@ export async function createServer(
   })
   mockTwilio(testNet.pds)
 
+  // add the test mod authority
+  if (!phoneRequired) {
+    const agent = new BskyAgent({service: pdsUrl})
+    const res = await agent.api.com.atproto.server.createAccount({
+      email: 'mod-authority@test.com',
+      handle: 'mod-authority.test',
+      password: 'hunter2',
+    })
+    agent.api.setHeader('Authorization', `Bearer ${res.data.accessJwt}`)
+    await agent.api.app.bsky.actor.profile.create(
+      {repo: res.data.did},
+      {
+        displayName: 'Dev-env Moderation',
+        description: `The pretend version of mod.bsky.app`,
+      },
+    )
+
+    await agent.api.app.bsky.labeler.service.create(
+      {repo: res.data.did, rkey: 'self'},
+      {
+        policies: {
+          labelValues: ['!hide', '!warn'],
+          labelValueDefinitions: [],
+        },
+        createdAt: new Date().toISOString(),
+      },
+    )
+  }
+
   const pic = fs.readFileSync(
     path.join(__dirname, '..', 'assets', 'default-avatar.png'),
   )
@@ -455,13 +485,13 @@ async function getPort(start = 3000) {
 }
 
 export const mockTwilio = (pds: TestPds) => {
-  if (!pds.ctx.twilio) return
+  if (!pds.ctx.phoneVerifier) return
 
-  pds.ctx.twilio.sendCode = async (_number: string) => {
+  pds.ctx.phoneVerifier.sendCode = async (_number: string) => {
     // do nothing
   }
 
-  pds.ctx.twilio.verifyCode = async (_number: string, code: string) => {
+  pds.ctx.phoneVerifier.verifyCode = async (_number: string, code: string) => {
     return code === '000000'
   }
 }