Skip to content

Tests: Refactor compareMetadata to handle both success and failure cases#2073

Merged
kfranqueiro merged 5 commits intomainfrom
kgf-test-metadata-failures
Mar 25, 2026
Merged

Tests: Refactor compareMetadata to handle both success and failure cases#2073
kfranqueiro merged 5 commits intomainfrom
kgf-test-metadata-failures

Conversation

@kfranqueiro
Copy link
Copy Markdown
Contributor

This is a follow-up to #2065 to address #2065 (comment).

Changes

  • Moves metadata failure case definition into samples.js where success cases are defined
    • Failure cases are distinguished by the presence of an errors array
  • Refactors compareMetadata to be driven by samples.js rather than using a hard-coded (and long-winded) set of checks
    • This required removing properties from samples.js which were never being compared before, and correcting one test fixture which was supposed to be compared but never was until this refactor
    • I was also able to remove the try/catch by instead using nextTick - previously, it seemed that a try/catch was sometimes but not always necessary to prevent the process from hanging, seemingly dependent on whether the final check resolved synchronously
    • I also took the opportunity to remove an unused argument (only used by code that has been commented out for probably a long time), and a util function that can be replaced by deep.equal.

I have verified that assertion failures behave as expected by altering various lines in samples.js.

- Remove properties from samples that were never tested previously
- Also fix a typo in 2021-wd-shortname-change.html,
  which was evidently not being tested before, but is now
@kfranqueiro kfranqueiro requested a review from deniak March 24, 2026 17:00
This actually causes hangs, and is not necessary
because unexpected errors will already fail the
property('success') assertion.
Copy link
Copy Markdown
Member

@deniak deniak left a comment

Choose a reason for hiding this comment

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

Nice simplification!

@kfranqueiro kfranqueiro merged commit 2ac0e50 into main Mar 25, 2026
10 checks passed
@kfranqueiro kfranqueiro deleted the kgf-test-metadata-failures branch March 25, 2026 16:37
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.

2 participants