feat: add brocker account list

This commit is contained in:
2026-08-13 20:57:01 +03:00
parent 18d7cfcf9f
commit c0a4a93880
7 changed files with 272 additions and 8 deletions
+19
View File
@@ -102,4 +102,23 @@ describe('Authentication (e2e)', () => {
expect(body).toEqual({ connected: false, connectedAt: null }),
);
});
it('guards brokerage accounts and reports a missing connection', async () => {
const registration = await request(app.getHttpServer())
.post('/api/v1/auth/register')
.send({ email: 'accounts@example.com', password: 'a secure password' })
.expect(201);
const accessToken = (registration.body as Authentication).accessToken;
await request(app.getHttpServer())
.get('/api/v1/brokerage-accounts')
.expect(401);
await request(app.getHttpServer())
.get('/api/v1/brokerage-accounts')
.set('Authorization', `Bearer ${accessToken}`)
.expect(409)
.expect(({ body }: { body: unknown }) =>
expect((body as Problem).code).toBe('TBANK_NOT_CONNECTED'),
);
});
});