Skip to content

Add comprehensive test coverage for Contracts View Page#734

Merged
StuartFerguson merged 5 commits intomainfrom
copilot/improve-code-coverage-contracts-another-one
Feb 4, 2026
Merged

Add comprehensive test coverage for Contracts View Page#734
StuartFerguson merged 5 commits intomainfrom
copilot/improve-code-coverage-contracts-another-one

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 4, 2026

Improve Code Coverage on Contracts View Page

Based on analysis of EstateIndexPageTests as a reference, added comprehensive tests for:

  • Button finding and clicking: Test "Back to List" button functionality
  • Navigation verification: Verify BackToList navigates to /contracts
  • Loading state verification: Test loading spinner display
  • Products display: Test products section when present and empty
  • Transaction fees display: Test transaction fees rendering
  • Error scenarios: Test for contract not found state
  • Contract not found: Test "Contract not found" state and back button
  • Fix build errors: Added missing using statements and corrected model types

Added 9 new tests following EstateIndexPageTests patterns:

  • ContractsView_HasBackButton
  • ContractsView_BackButton_NavigatesToContractsList
  • ContractsView_DisplaysProducts_WhenPresent
  • ContractsView_DisplaysNoProducts_WhenEmpty
  • ContractsView_DisplaysTransactionFees_WhenPresent
  • ContractsView_LoadContract_QueryFails_ShowsNotFoundMessage
  • ContractsView_LoadContract_ReturnsNull_ShowsNotFoundMessage
  • ContractsView_ContractNotFound_HasBackButton
  • ContractsView_ContractNotFound_BackButton_NavigatesToContractsList

Total tests: 12 (was 3, added 9)

Build fixes:

  • Added using AngleSharp.Dom; for IElement type
  • Removed using EstateManagementUI.BlazorServer.Models; to avoid ambiguous references
  • Used BusinessLogic.Models types consistently (ProductType as string, CalculationType/FeeType as int)
Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Code Coverage on Contracts View Page</issue_title>
<issue_description>Use the estate index page tests as a guide on how to find buttons and also verify navigation</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Improve code coverage on contracts view page Add comprehensive test coverage for Contracts View Page Feb 4, 2026
Copilot AI requested a review from StuartFerguson February 4, 2026 13:38
@StuartFerguson
Copy link
Copy Markdown
Member

@copilot code failed to build

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 4, 2026

@copilot code failed to build

Fixed in commit 8165127. The build errors were caused by:

  1. Missing using AngleSharp.Dom; for the IElement type
  2. Ambiguous reference to ContractModel due to importing both EstateManagementUI.BlazorServer.Models and EstateManagementUI.BusinessLogic.Models - removed the BlazorServer.Models import
  3. Incorrect types for enum properties - BusinessLogic.Models uses string for ProductType and int for CalculationType/FeeType

The tests now use BusinessLogic.Models consistently, matching the pattern in EstateIndexPageTests.

@StuartFerguson StuartFerguson marked this pull request as ready for review February 4, 2026 14:15
@StuartFerguson StuartFerguson merged commit f46616b into main Feb 4, 2026
10 checks passed
@github-actions github-actions Bot deleted the copilot/improve-code-coverage-contracts-another-one branch April 6, 2026 01:14
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.

Improve Code Coverage on Contracts View Page

2 participants