Skip to content

Commit

Permalink
Resolve TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
duncancmt committed Jan 8, 2024
1 parent 9c84ac5 commit 15b1ac8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/deployer/Deployer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@ contract DeployerTest is Test {
deployer.acceptOwnership();
}

// TODO: testSetDescription
bytes32 ipfsHash = 0x55fa85b555094012e583d2ddcb777745ff7f343991c11aa6e75dccca1bb456ed;
bytes32 ipfsUriHash = keccak256("ipfs://QmU8GviotZ9EvE2zHd8DwM8RqNnJfinax8s8mgTg8k4Tm6");

function testSetDescription() public {
assertEq(keccak256(bytes(deployer.setDescription(1, "nothing to see here"))), ipfsUriHash);
assertEq(deployer.descriptionHash(1), ipfsHash);
}

function testSetDescriptionNotOwner() public {
vm.expectRevert(abi.encodeWithSignature("PermissionDenied()"));
vm.startPrank(auth);
deployer.setDescription(1, "nothing to see here");
}

event Authorized(uint128 indexed, address indexed, uint256);

Expand Down Expand Up @@ -142,4 +154,11 @@ contract DeployerTest is Test {
assertTrue(deployer.setUnsafe(1, nonce));
assertEq(deployer.ownerOf(1), instance, "reverts to previous deployment");
}

function testTokenURI() public {
deployer.setDescription(1, "nothing to see here");
deployer.authorize(1, address(this), block.timestamp + 1 days);
deployer.deploy(1, type(Dummy).creationCode);
assertEq(ipfsUriHash, keccak256(bytes(deployer.tokenURI(1))));
}
}

0 comments on commit 15b1ac8

Please sign in to comment.