feat: add portfolio
This commit is contained in:
@@ -121,4 +121,23 @@ describe('Authentication (e2e)', () => {
|
||||
expect((body as Problem).code).toBe('TBANK_NOT_CONNECTED'),
|
||||
);
|
||||
});
|
||||
|
||||
it('guards portfolio and reports a missing connection', async () => {
|
||||
const registration = await request(app.getHttpServer())
|
||||
.post('/api/v1/auth/register')
|
||||
.send({ email: 'portfolio@example.com', password: 'a secure password' })
|
||||
.expect(201);
|
||||
const accessToken = (registration.body as Authentication).accessToken;
|
||||
|
||||
await request(app.getHttpServer())
|
||||
.get('/api/v1/brokerage-accounts/account/portfolio')
|
||||
.expect(401);
|
||||
await request(app.getHttpServer())
|
||||
.get('/api/v1/brokerage-accounts/account/portfolio')
|
||||
.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