Skip to content

Commit

Permalink
fix: coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroknots committed Feb 21, 2024
1 parent 020ae75 commit 1b92436
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/Attestation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,32 @@ contract AttestationTest is BaseTest {
assertEq(record.attester, attester1.addr);
}

function test_WhenUsingValidMultiDifferentResolver__ShouldRevert() public prankWithAccount(attester1) {
// It should recover.
uint32[] memory types = new uint32[](1);

AttestationRequest[] memory requests = new AttestationRequest[](2);
requests[0] = mockAttestation(address(module1), uint48(block.timestamp + 100), "", types);
requests[1] = mockAttestation(address(module3), uint48(block.timestamp + 100), "", types);

vm.expectRevert();
registry.attest(defaultSchemaUID, requests);
}

function test_WhenUsingValidMulti__Revocation() public {
test_WhenUsingValidMulti();

RevocationRequest[] memory requests = new RevocationRequest[](2);
requests[0] = mockRevocation(address(module1));
requests[1] = mockRevocation(address(module2));

vm.prank(attester2.addr);
vm.expectRevert();
registry.revoke(requests);
vm.prank(attester1.addr);
registry.revoke(requests);
vm.expectRevert();
registry.revoke(requests);
}

function test_findAttestation() public {
Expand Down
8 changes: 8 additions & 0 deletions test/Base.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ contract BaseTest is Test {
MockResolver resolverFalse;
MockResolver resolverTrue;

MockResolver differentResolver;

MockSchemaValidator schemaValidatorFalse;
MockSchemaValidator schemaValidatorTrue;

Expand All @@ -41,6 +43,7 @@ contract BaseTest is Test {
string defaultSchema = "Foobar";
SchemaUID defaultSchemaUID;
ResolverUID internal defaultResolverUID;
ResolverUID internal differentResolverUID;

function setUp() public virtual {
vm.warp(1_641_070_800);
Expand All @@ -61,6 +64,7 @@ contract BaseTest is Test {

resolverFalse = new MockResolver(false);
resolverTrue = new MockResolver(true);
differentResolver = new MockResolver(true);

schemaValidatorFalse = new MockSchemaValidator(false);
schemaValidatorTrue = new MockSchemaValidator(true);
Expand All @@ -85,12 +89,16 @@ contract BaseTest is Test {
vm.prank(opsEntity1.addr);
defaultResolverUID = registry.registerResolver(IExternalResolver(address(resolverTrue)));
vm.prank(opsEntity1.addr);
differentResolverUID = registry.registerResolver(IExternalResolver(address(differentResolver)));
vm.prank(opsEntity1.addr);
defaultSchemaUID = registry.registerSchema(defaultSchema, IExternalSchemaValidator(address(schemaValidatorTrue)));

vm.prank(moduleDev1.addr);
registry.registerModule(defaultResolverUID, address(module1), "");
vm.prank(moduleDev2.addr);
registry.registerModule(defaultResolverUID, address(module2), "");
vm.prank(moduleDev1.addr);
registry.registerModule(differentResolverUID, address(module3), "");

AttestationRequest memory req = AttestationRequest({
moduleAddr: address(module1),
Expand Down

0 comments on commit 1b92436

Please sign in to comment.