Add failsafe error catch if card object is undefined during metadata initialisation #477

Open
Vylpes wants to merge 4 commits from feature/473-card-object-undefined into release/0.10.0
Owner
  • Add unit tests for the failsafe

#473

- Add unit tests for the failsafe #473
Add unit tests for the failsafe on card object being undefined
Some checks failed
Test / build (push) Failing after 54s
0029babb13
Fix tests
All checks were successful
Test / build (push) Successful in 53s
52c6ecd1cd
Fix failsafe not taking into account if a json file has other series in it
All checks were successful
Test / build (push) Successful in 55s
5d74e00357
Vylpes requested review from Copilot 2025-11-12 18:08:30 +00:00
Copilot left a comment
Member

I'll review this diff for you. This appears to be a bug fix with added test coverage for the CardMetadataFunction.

Summary

The changes fix a bug where only the first series in a JSON file was validated for cards, and adds comprehensive unit tests to prevent regression.

Verdict

Approve with minor fixes - The core bug fix is solid and the tests are valuable. Just fix the typo in the function name and consider the validation ordering question.

I'll review this diff for you. This appears to be a bug fix with added test coverage for the `CardMetadataFunction`. ## Summary The changes fix a bug where only the first series in a JSON file was validated for cards, and adds comprehensive unit tests to prevent regression. ## Verdict **Approve with minor fixes** - The core bug fix is solid and the tests are valuable. Just fix the typo in the function name and consider the validation ordering question.
@ -0,0 +1,43 @@
import {CardMetadata} from "../../../src/contracts/SeriesMetadata";
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Required to test non-confirmed json data
export default function GenenerateSeriesMetadata(id: number, name: string, generateSeries: number = 1, generateCards: number | number[] = 1): any[] {
Member

Typo in Function Name

Typo in Function Name
All checks were successful
Test / build (push) Successful in 55s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature/473-card-object-undefined:feature/473-card-object-undefined
git switch feature/473-card-object-undefined

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch release/0.10.0
git merge --no-ff feature/473-card-object-undefined
git switch feature/473-card-object-undefined
git rebase release/0.10.0
git switch release/0.10.0
git merge --ff-only feature/473-card-object-undefined
git switch feature/473-card-object-undefined
git rebase release/0.10.0
git switch release/0.10.0
git merge --no-ff feature/473-card-object-undefined
git switch release/0.10.0
git merge --squash feature/473-card-object-undefined
git switch release/0.10.0
git merge --ff-only feature/473-card-object-undefined
git switch release/0.10.0
git merge feature/473-card-object-undefined
git push origin release/0.10.0
Sign in to join this conversation.
No description provided.