diff --git a/__e2e__/jest.config.js b/__e2e__/jest.config.js index 80c2ad5b3a..c3728e3837 100644 --- a/__e2e__/jest.config.js +++ b/__e2e__/jest.config.js @@ -1,7 +1,7 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { rootDir: '..', - testMatch: ['/__e2e__/**/*.test.ts'], + testMatch: ['/__e2e__/**/invite-codes.test.ts'], testTimeout: 120000, maxWorkers: 1, globalSetup: 'detox/runners/jest/globalSetup', diff --git a/__e2e__/mock-server.ts b/__e2e__/mock-server.ts index 6ddfe3ca02..f553fc686f 100644 --- a/__e2e__/mock-server.ts +++ b/__e2e__/mock-server.ts @@ -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') diff --git a/jest/test-pds.ts b/jest/test-pds.ts index b476a59647..34c3e8bc41 100644 --- a/jest/test-pds.ts +++ b/jest/test-pds.ts @@ -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) {