Add Diamond contract unit tests - #224
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds unit tests for the Diamond contract as part of the migration to the Diamond pattern (ERC-2535). The tests verify Diamond contract deployment behavior, ownership setting, and facet cut functionality.
- Adds comprehensive unit tests for Diamond contract deployment scenarios
- Updates license headers to use SPDX-FileCopyrightText format
- Removes legacy Migrations.sol contract that's no longer needed
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/byContract/Diamond.test.ts | New test file covering Diamond deployment, ownership, and facet cut functionality |
| contracts/tools/Migrations.sol | Removed legacy migrations contract |
| contracts/Diamond.sol | Updated license header and comment formatting |
| CHANGELOG.md | Added entry documenting the new Diamond unit tests |
Comments suppressed due to low confidence (2)
test/byContract/Diamond.test.ts:66
- The fallback redirection functionality mentioned in the PR description is not tested. Consider implementing this test to ensure the Diamond proxy correctly redirects fallback calls to facets.
it.skip('[TODO] Should redirect fallback', async () => {});
test/byContract/Diamond.test.ts:67
- The receive redirection functionality mentioned in the PR description is not tested. Consider implementing this test to ensure the Diamond proxy correctly redirects receive calls to facets.
it.skip('[TODO] Should redirect receive', async () => {});
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/diamond #224 +/- ##
===================================================
+ Coverage 84.35% 84.44% +0.08%
===================================================
Files 37 37
Lines 1112 1112
Branches 225 225
===================================================
+ Hits 938 939 +1
+ Misses 174 173 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| * @param deployer Signer to deploy the library. | ||
| * @returns The library configuration or an empty object. | ||
| */ | ||
| export async function getLibDiamondConfigOrEmpty(deployer: SignerWithAddress): Promise<any> { |
There was a problem hiding this comment.
is it possible to type the promise output ?
There was a problem hiding this comment.
It generates a typing error so I use the generic type any.
Migration steps:
receiveandfallbackbehavior inDiamond.solModuletoFacetin contracts namesDiamond.sol