feat: add brocker account list
This commit is contained in:
@@ -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'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user