test(turmas): valida proxy de /turmas e /usuarios/:id com perfil aluno#14
Merged
Conversation
Adiciona o bloco describe('/api/v1/turmas') cobrindo rejeicao sem token,
proxy de GET /turmas e GET /turmas/:id para o Quiz-Service e validando
que X-User-Papel=ALUNO chega ao downstream. Inclui describe para a busca
publica GET /api/v1/usuarios/:id confirmando que o aluno tambem alcanca
o Backend com X-User-Id e X-User-Papel injetados pelo proxy, atendendo
a composicao do nome do professor no fluxo Minhas Turmas.
Co-authored-by: GenilsonJrs <genilson.junior.99006@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds new integration tests to validate proxy behavior and header injection for the /api/v1/turmas routes and for GET /api/v1/usuarios/:id when authenticated as an ALUNO, ensuring requests are routed to the correct downstream service.
Changes:
- Added integration coverage for
/api/v1/turmas(401 without token; proxy to Quiz-Service withx-user-*headers). - Added integration coverage for
GET /api/v1/usuarios/:id(proxy to Backend withx-user-*headers).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+271
to
+281
| describe("/api/v1/usuarios/:id (busca publica)", () => { | ||
| it("repassa GET /usuarios/:id de aluno para o Backend injetando X-User-Papel=ALUNO", async () => { | ||
| backendMock.request.mockResolvedValue({ | ||
| status: 200, | ||
| data: { mensagem: "ok", dados: { id: "prof-1", nome: "Maria", papel: "PROFESSOR" } }, | ||
| headers: {}, | ||
| }); | ||
|
|
||
| const resposta = await request(aplicacao) | ||
| .get("/api/v1/usuarios/prof-1") | ||
| .set("Authorization", `Bearer ${tokenValido()}`); |
Co-authored-by: GenilsonJrs <genilson.junior.99006@gmail.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Uh oh!
There was an error while loading. Please reload this page.