Skip to content

test(turmas): valida proxy de /turmas e /usuarios/:id com perfil aluno#14

Merged
GenilsonJrs merged 3 commits into
mainfrom
feature/minhas-turmas-aluno
May 24, 2026
Merged

test(turmas): valida proxy de /turmas e /usuarios/:id com perfil aluno#14
GenilsonJrs merged 3 commits into
mainfrom
feature/minhas-turmas-aluno

Conversation

@EhOMiguel

@EhOMiguel EhOMiguel commented May 21, 2026

Copy link
Copy Markdown
Collaborator

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 with x-user-* headers).
  • Added integration coverage for GET /api/v1/usuarios/:id (proxy to Backend with x-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()}`);
Comment thread tests/integration/app.spec.ts
@pkbceira03 pkbceira03 self-requested a review May 21, 2026 11:48

@pkbceira03 pkbceira03 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tudo certo!

EhOMiguel and others added 2 commits May 21, 2026 12:39
@sonarqubecloud

Copy link
Copy Markdown

@GenilsonJrs GenilsonJrs merged commit fb8a344 into main May 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants