ryer.io

AiCatalogItemMetadata Component Test

TL;DR

  • Wrote a test suite for AiCatalogItemMetadata using shallowMountExtended and stubbed GlIcon
  • Test verifies date fields render with correct icons: ‘calendar’ for Created and ‘clock’ for Modified
  • Checked that ‘Created on January 15, 2024’ and ‘Modified Aug 21, 2025’ text appears correctly
  • Added a case where createdAt and updatedAt match, expecting only ‘Created’ to show and no ‘Modified’ text

Test details

Set up the component test using shallowMountExtended, passing mockAgent as the default item prop and stubbing GlIcon via stubComponent. The first test checks that when date fields are provided, two list items render with the correct icons (‘calendar’ and ‘clock’) and the correct text (‘Created on January 15, 2024’ and ‘Modified Aug 21, 2025’). The second test covers the case where updatedAt and latestVersion.updatedAt match createdAt, expecting only one list item showing ‘Created’, with no ‘Modified’ text appearing anywhere in the component.