Fix the invite test construction

This commit is contained in:
Paul Frazee
2023-06-27 20:47:24 -05:00
parent 24f919d0de
commit dab22aa3e5
3 changed files with 19 additions and 2 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
rootDir: '..',
testMatch: ['<rootDir>/__e2e__/**/*.test.ts'],
testMatch: ['<rootDir>/__e2e__/**/invite-codes.test.ts'],
testTimeout: 120000,
maxWorkers: 1,
globalSetup: 'detox/runners/jest/globalSetup',
+3
View File
@@ -34,6 +34,9 @@ async function main() {
displayName: 'Carla',
description: 'Test user 3',
}))
if (inviteRequired) {
await server.mocker.createInvite(server.mocker.users.alice.did)
}
}
if ('follows' in url.query) {
console.log('Generating mock follows')
+15 -1
View File
@@ -24,7 +24,6 @@ export async function createServer(
const port = await getPort()
const port2 = await getPort(port + 1)
const pdsUrl = `http://localhost:${port}`
console.log({port})
const {pds, plc} = await TestNetworkNoAppView.create({
pds: {port, publicUrl: pdsUrl, inviteRequired},
plc: {port: port2},
@@ -191,6 +190,21 @@ class Mocker {
return await agent.like(uri, cid)
}
async createInvite(forAccount: string) {
const agent = new BskyAgent({service: this.agent.service})
await agent.api.com.atproto.server.createInviteCode(
{useCount: 1, forAccount},
{
headers: {
authorization: `Basic ${btoa(
`admin:${this.pds.ctx.cfg.adminPassword}`,
)}`,
},
encoding: 'application/json',
},
)
}
async labelAccount(label: string, user: string) {
const did = this.users[user]?.did
if (!did) {