Repository navigation
test(b3): accept empty fund lists for FIAGRO-FIDC and FIA - #824
Closed
mateussiqueira wants to merge 2 commits into
Closed
mateussiqueira wants to merge 2 commits into
mateussiqueira wants to merge 2 commits into
Conversation
B3 legitimately returns empty arrays for FIAGRO-FIDC and FIA fund types when no tickers are listed. The tests used expect.arrayContaining which requires at least one element. Replace with expectValidFundListOrEmpty helper that validates the array structure and only checks schema when items exist. Fixes BrasilAPI#800
|
Deployment failed with the following error: |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The parseObject function expected tipo_ato_ini / numero_ato_ini / ano_ato_ini (old upstream format), but the Siscomex API changed to tipo_ato / numero_ato / ano_ato. The fallback ncmList.json also uses the new format. When the upstream rate limit (3 req/h) was hit, the fallback produced undefined values because the destructured _ini fields didn't exist, causing tipo_ato / numero_ato / ano_ato to be omitted from the response. Fix: destructure both naming conventions, preferring the new format with nullish coalescing (??) as fallback. Fixes BrasilAPI#796
|
Member
|
Oi @mateussiqueira! Obrigado pela contribuição! 🙏 Esse PR mistura duas correções que estão sendo tratadas separadamente:
Fechando este PR em favor do #822 + #825. Se discordar, comenta aqui que a gente reavalia! 💪 |
13 tasks done
This branch had an error being deployed
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.



Problema
Os testes de fundos B3 para FIAGRO-FIDC e FIA usam
expect.arrayContaining, que exige pelo menos um item. Porém a B3 pode legitimamente retornar[]para esses tipos.Reprodução
curl https://brasilapi.com.br/api/tickers/b3/fundos/v1/FIAGRO-FIDC # → [] (válido, mas teste falha)Solução
Extrai um helper
expectValidFundListOrEmptyque valida o array e, se não vazio, aplica o schema normalmente.Closes #800