Fix the invite test construction
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/** @type {import('@jest/types').Config.InitialOptions} */
|
/** @type {import('@jest/types').Config.InitialOptions} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
rootDir: '..',
|
rootDir: '..',
|
||||||
testMatch: ['<rootDir>/__e2e__/**/*.test.ts'],
|
testMatch: ['<rootDir>/__e2e__/**/invite-codes.test.ts'],
|
||||||
testTimeout: 120000,
|
testTimeout: 120000,
|
||||||
maxWorkers: 1,
|
maxWorkers: 1,
|
||||||
globalSetup: 'detox/runners/jest/globalSetup',
|
globalSetup: 'detox/runners/jest/globalSetup',
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ async function main() {
|
|||||||
displayName: 'Carla',
|
displayName: 'Carla',
|
||||||
description: 'Test user 3',
|
description: 'Test user 3',
|
||||||
}))
|
}))
|
||||||
|
if (inviteRequired) {
|
||||||
|
await server.mocker.createInvite(server.mocker.users.alice.did)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ('follows' in url.query) {
|
if ('follows' in url.query) {
|
||||||
console.log('Generating mock follows')
|
console.log('Generating mock follows')
|
||||||
|
|||||||
+15
-1
@@ -24,7 +24,6 @@ export async function createServer(
|
|||||||
const port = await getPort()
|
const port = await getPort()
|
||||||
const port2 = await getPort(port + 1)
|
const port2 = await getPort(port + 1)
|
||||||
const pdsUrl = `http://localhost:${port}`
|
const pdsUrl = `http://localhost:${port}`
|
||||||
console.log({port})
|
|
||||||
const {pds, plc} = await TestNetworkNoAppView.create({
|
const {pds, plc} = await TestNetworkNoAppView.create({
|
||||||
pds: {port, publicUrl: pdsUrl, inviteRequired},
|
pds: {port, publicUrl: pdsUrl, inviteRequired},
|
||||||
plc: {port: port2},
|
plc: {port: port2},
|
||||||
@@ -191,6 +190,21 @@ class Mocker {
|
|||||||
return await agent.like(uri, cid)
|
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) {
|
async labelAccount(label: string, user: string) {
|
||||||
const did = this.users[user]?.did
|
const did = this.users[user]?.did
|
||||||
if (!did) {
|
if (!did) {
|
||||||
|
|||||||
Reference in New Issue
Block a user