Feat: listar buscar tipos vegetação Api.v2 - #507
Open
JosueModesto wants to merge 3 commits into
Hidden character warning
The head ref may contain hidden characters: "489-listar-buscar-tipos-vegeta\u00e7\u00e3o"
Open
Conversation
edvaldoszy
reviewed
Aug 29, 2026
| try { | ||
| const response = await agent.get('/api/v2/vegetacoes').expect(200) | ||
| const expected = [...inserted].sort((a, b) => b.id - a.id) | ||
| expect(response.body).toEqual(expected) |
Collaborator
There was a problem hiding this comment.
As asserções da listagem sem filtro comparam o corpo inteiro só com as linhas inseridas neste teste. O setup de integração trunca apenas paises e estados, então qualquer residual em vegetacoes (teste paralelo ou falha anterior) quebra o teste de ordem padrão e o de order customizada. O padrão de países filtra por prefixo único e compara só o recorte.
edvaldoszy
reviewed
Aug 29, 2026
| if (!order) return undefined | ||
|
|
||
| const [column, direction] = order.split(':') | ||
| const normalizedColumn = column === 'nome' || column === 'id' ? column : 'id' |
Collaborator
There was a problem hiding this comment.
parseOrder normaliza coluna/direção inválidas em silêncio para id/desc. Valores como order=nome:ASC ou order=foo:bar não devolvem 400; a direção em maiúsculas cai no default desc. Se a UI enviar o formato da listagem legado, a ordem pode ficar invertida sem erro explícito.
edvaldoszy
requested changes
Aug 29, 2026
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.
Close #489
O que foi feito
Foi implementado o módulo de leitura de tipos de vegetação na API v2, preservando o comportamento legado da rota antiga.
Alterações principais
Cobertura de testes